public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21498] New: clause 7.1.5.3/2 of the c++ is not enforced
@ 2005-05-10 16:18 jkherciueh at gmx dot net
  2005-05-10 16:31 ` [Bug c++/21498] " pinskia at gcc dot gnu dot org
  2005-08-14 16:48 ` fn_x at hotmail dot com
  0 siblings, 2 replies; 16+ messages in thread
From: jkherciueh at gmx dot net @ 2005-05-10 16:18 UTC (permalink / raw)
  To: gcc-bugs

The following code should be rejected, but is accepted by g++:


template < typename T >
class identity {
public:

  typedef T me;

};

template < typename T >
class my_friend {
private:

  friend class identity< T >::me;

  char x;

};

class The_T {
public:

  static
  char & peek_friend ( my_friend< The_T > & f ) {
    return( f.x );
  }
  
};

int main (void) {
  my_friend< The_T > x;
}


The configuration is:

gcc> g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.0/configure --prefix=/pkg/gcc-4.0.0/usr
Thread model: posix
gcc version 4.0.0


The code is illegal because the friend declaration resolves into the
typedef "me" (7.1.5.3/2).

PS: I do not really understand why the standard is worded this way.
    It appears that templated friendship could be good.

-- 
           Summary: clause 7.1.5.3/2 of the c++ is not enforced
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jkherciueh at gmx dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2009-11-03 18:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21498-8718@http.gcc.gnu.org/bugzilla/>
2006-07-01  1:06 ` [Bug c++/21498] clause 7.1.5.3/2 of the c++ is not enforced fang at csl dot cornell dot edu
2006-07-01 11:18 ` steven at gcc dot gnu dot org
2006-07-01 22:09 ` mmitchel at gcc dot gnu dot org
2006-07-02  8:44 ` truedfx at gentoo dot org
2006-07-02 17:37 ` fang at csl dot cornell dot edu
2006-07-03  5:19 ` mmitchel at gcc dot gnu dot org
2006-09-05 10:21 ` pluto at agmk dot net
2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
2006-09-18 23:42 ` pinskia at gcc dot gnu dot org
2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
2006-09-18 23:43 ` pinskia at gcc dot gnu dot org
2006-09-18 23:44 ` [Bug c++/21498] [c++0x] " pinskia at gcc dot gnu dot org
2006-09-19  5:18 ` pinskia at gcc dot gnu dot org
2009-11-03 18:40 ` [Bug c++/21498] [c++0x] friend declaration can name non-class with class-key jason at gcc dot gnu dot org
2005-05-10 16:18 [Bug c++/21498] New: clause 7.1.5.3/2 of the c++ is not enforced jkherciueh at gmx dot net
2005-05-10 16:31 ` [Bug c++/21498] " pinskia at gcc dot gnu dot org
2005-08-14 16:48 ` fn_x at hotmail dot com

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).