From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8615 invoked by alias); 8 Jul 2005 19:51:07 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8595 invoked by uid 48); 8 Jul 2005 19:51:01 -0000 Date: Fri, 08 Jul 2005 19:51:00 -0000 From: "John at xza5 dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20050708195057.22378.John@xza5.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/22378] New: [regression 4.0.1 -> 4.0.0,3.4.x] Friend decl ceases to declare class X-Bugzilla-Reason: CC X-SW-Source: 2005-07/txt/msg01040.txt.bz2 List-Id: [jv@smith misc]$ cat -n decl_friend_class.cpp 1 2 #ifdef DD 3 class d; 4 #endif 5 6 class c 7 { 8 friend class d; 9 d* p; 10 }; 11 [jv@smith misc]$ /usr/local/gcc/gcc-4.0.0/bin/g++ -c -W -Wall decl_friend_class.cpp [jv@smith misc]$ /usr/local/gcc/gcc-4.0.1/bin/g++ -c -W -Wall decl_friend_class.cpp decl_friend_class.cpp:9: error: ISO C++ forbids declaration of 'd' with no type decl_friend_class.cpp:9: error: expected ';' before '*' token [jv@smith misc]$ /usr/local/gcc/gcc-4.0.1/bin/g++ -c -W -Wall -fpermissive decl_friend_class.cpp decl_friend_class.cpp:9: warning: ISO C++ forbids declaration of 'd' with no type decl_friend_class.cpp:9: error: expected ';' before '*' token [jv@smith misc]$ /usr/local/gcc/gcc-4.0.1/bin/g++ -c -W -Wall -DDD decl_friend_class.cpp [jv@smith misc]$ icc -c -w2 decl_friend_class.cpp [jv@smith misc]$ The icc here is icc 8.1 The original testcase comes from SystemC 2.0.1, in include/systemc/kernel/sc_module_name.h ( http://www.systemc.org/ ) IANAC++LL. It is not immediately clear to me from the standard whether a friend class decl declares that class, though the description of a friend function decl suggests - to me, anyway - that it might. I would be grateful if anyone could refer me to a discussion of whether or not this is valid C++, acording to current interpretations of the standard. However: I believe that this code is accepted by gcc-2.95, gcc-3.2.x, gcc-3.4.x, gcc-4.0.0 without warning, so if it has been determined to be invalid, it should reeceive a "deprecated" warning and/or require -fpermissive before it ceases to be accepted by gcc. Regards, John. I will test minor release candidates more in future... -- Summary: [regression 4.0.1 -> 4.0.0,3.4.x] Friend decl ceases to declare class Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: John at xza5 dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22378