www.digitalmars.com         C & C++   DMDScript  

c++ - Error not caught (friend class T;)

reply dan <dan_member pathlink.com> writes:
template< typename Y >
class x
{
friend class Y;
};

Is an error, but compiles in DM.  Comeau on-line compiler says:

"ComeauTest.c", line 4: error: template parameter "Y" may not be used in an
elaborated type specifier
friend class Y;
^
Cheers!
Jan 10 2004
parent reply "Matthew" <matthew.hat stlsoft.dot.org> writes:
 template< typename Y >
 class x
 {
 friend class Y;
 };

 Is an error, but compiles in DM.  Comeau on-line compiler says:

 "ComeauTest.c", line 4: error: template parameter "Y" may not be used in
an
 elaborated type specifier
 friend class Y;
 ^
 Cheers!
This is about the least valid error in the business. Check out http://www.cuj.com/documents/s=8942/cujweb0312wilson/, and also note that Comeau have recently added a --friendT option to v4.3.3 to specifically legalise it when compiling in --strict mode. This behaviour is one of the one's most likely to be legalised in the next version of the standard, and is profoundly useful, so it'd be crazy for any vendor to attempt to change their support for it. Cheers -- Matthew Wilson STLSoft moderator (http://www.stlsoft.org) Contributing editor, C/C++ Users Journal (www.synesis.com.au/articles.html#columns) "If I'm curt with you it's because time is a factor. I think fast, I talk fast, and I need you guys to act fast" -- Mr Wolf ---------------------------------------------------------------------------- ---
Jan 10 2004
parent "Jonathan Turkanis" <technews kangaroologic.com> writes:
"Matthew" <matthew.hat stlsoft.dot.org> wrote in message:
 template< typename Y >
 class x
 {
 friend class Y;
 };

 Is an error, but compiles in DM.  Comeau on-line compiler says:

 "ComeauTest.c", line 4: error: template parameter "Y" may not be
used in
 an
 elaborated type specifier
 friend class Y;
 ^
 Cheers!
This is about the least valid error in the business. Check out http://www.cuj.com/documents/s=8942/cujweb0312wilson/, and also note
that
 Comeau have recently added a --friendT option to v4.3.3 to
specifically
 legalise it when compiling in --strict mode. This behaviour is one
of the
 one's most likely to
 be legalised in the next version of the standard, and is profoundly
useful,
 so it'd be crazy for any vendor to attempt to change their support
for it.
 Cheers
You probably noticed a recent post by Andrei Alexandrescu on comp.lang.c++.moderated refering to your article. (See http://www.talkaboutprogramming.com/group/comp.lang.c++.moderated/messages/153854.html.) He asked "are friend template arguments a de facto feature ready to make it into the standard?" I was hoping some standards committee members would respond, but none did. What is your evidence that this will likely be legalized? I certainly hope you are right. Jonathan
Jan 11 2004