This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29123] New: accepts typedef as elaborated type specifier in friend declaration
- From: "gcc at pdoerfler dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Sep 2006 09:26:02 -0000
- Subject: [Bug c++/29123] New: accepts typedef as elaborated type specifier in friend declaration
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the following testcase wrap<C>::type is accepted as elaborate type specifier
which AFAIU is not permitted by the current standard.
-------------------------------------------------------------
template <class C>
struct wrap
{
typedef C type;
};
template <class T>
class foo
{
friend class wrap<T>::type;
// T t;
};
template <typename U>
class bar
{
// bar();
};
foo<bar<int> > 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<T>::type;
^
detected during instantiation of class "foo<T> [with T=bar<int>]" 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