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; 3+ 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] 3+ messages in thread
end of thread, other threads:[~2005-08-14 16:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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).