From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18830 invoked by alias); 18 Sep 2006 09:26:10 -0000 Received: (qmail 18734 invoked by uid 48); 18 Sep 2006 09:26:02 -0000 Date: Mon, 18 Sep 2006 09:26:00 -0000 Subject: [Bug c++/29123] New: accepts typedef as elaborated type specifier in friend declaration X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gcc at pdoerfler dot com" 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 X-SW-Source: 2006-09/txt/msg01687.txt.bz2 List-Id: In the following testcase wrap::type is accepted as elaborate type specifier which AFAIU is not permitted by the current standard. ------------------------------------------------------------- template struct wrap { typedef C type; }; template class foo { friend class wrap::type; // T t; }; template class bar { // bar(); }; foo > f; ------------------------------------------------ ICC9.1 rejects this code with: testTypedefFriend.cpp(10): error: typedef "type" may not be used in an elaborated type specifier friend class wrap::type; ^ detected during instantiation of class "foo [with T=bar]" at line 20 This code will probably be valid in C++0x if I understand http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf correctly. But gcc doesn't implement that behavior either as can be seen by uncommenting the two lines in the snippet above. Possibly related to: PR22047 /usr/local/4.2/bin/g++4.2.0 -v -c testTypedefFriend.cpp Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.2-svn/configure --prefix=/usr/local/4.2 --program-suffix=4.2.0 --enable-languages=c,c++,fortran Thread model: posix gcc version 4.2.0 20060918 (experimental) /usr/local/4.2/libexec/gcc/i686-pc-linux-gnu/4.2.0/cc1plus -quiet -v -D_GNU_SOURCE testTypedefFriend.cpp -quiet -dumpbase testTypedefFriend.cpp -mtune=generic -auxbase testTypedefFriend -version -o /tmp/cc79A4Nh.s ignoring nonexistent directory "/usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0 /usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/i686-pc-linux-gnu /usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/backward /usr/local/include /usr/local/4.2/include /usr/local/4.2/lib/gcc/i686-pc-linux-gnu/4.2.0/include /usr/include End of search list. GNU C++ version 4.2.0 20060918 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.2.0 20060918 (experimental). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: febaaa122a095acbe60b52a3bc2a2eca as -V -Qy -o testTypedefFriend.o /tmp/cc79A4Nh.s GNU assembler version 2.16.91.0.5 (i586-suse-linux) using BFD version 2.16.91.0.5 20051219 (SUSE Linux) -- Summary: accepts typedef as elaborated type specifier in friend declaration Product: gcc Version: 3.3.6 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gcc at pdoerfler dot com GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29123