public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29123]  New: accepts typedef as elaborated type specifier in friend declaration
@ 2006-09-18  9:26 gcc at pdoerfler dot com
  2006-09-18 23:38 ` [Bug c++/29123] " fang at csl dot cornell dot edu
  2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: gcc at pdoerfler dot com @ 2006-09-18  9:26 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/29123] accepts typedef as elaborated type specifier in friend declaration
  2006-09-18  9:26 [Bug c++/29123] New: accepts typedef as elaborated type specifier in friend declaration gcc at pdoerfler dot com
@ 2006-09-18 23:38 ` fang at csl dot cornell dot edu
  2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: fang at csl dot cornell dot edu @ 2006-09-18 23:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fang at csl dot cornell dot edu  2006-09-18 23:38 -------
Motion to dupe as PR 21498.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29123


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/29123] accepts typedef as elaborated type specifier in friend declaration
  2006-09-18  9:26 [Bug c++/29123] New: accepts typedef as elaborated type specifier in friend declaration gcc at pdoerfler dot com
  2006-09-18 23:38 ` [Bug c++/29123] " fang at csl dot cornell dot edu
@ 2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-18 23:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-09-18 23:42 -------


*** This bug has been marked as a duplicate of 21498 ***

*** This bug has been marked as a duplicate of 21498 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29123


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-09-18 23:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-18  9:26 [Bug c++/29123] New: accepts typedef as elaborated type specifier in friend declaration gcc at pdoerfler dot com
2006-09-18 23:38 ` [Bug c++/29123] " fang at csl dot cornell dot edu
2006-09-18 23:43 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).