ISO/ANSI violation on elaborated type specifiers.

Geir Bjarte Terum gb@funcom.com
Thu May 13 11:38:00 GMT 1999


// Subject: ISO/ANSI violation on elaborated type specifiers.
//
// Ref: ISO/IEC 14882-1998 section 7.1.5.3
//
// Comments:
// To be more ISO/ANSI compatible, the g++ compiler should assert
// the use of template parameters being used in an elaborated type
// specifier, and e.g give an error in pedantic mode or at least
// a warning with the -ansi option specified.
//
// Command line: g++ -Wall -ansi -pedantic ansi_violation_#N.cpp
//
// Versions:
//   gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
//   gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
//
// Platforms:
// * Digital Unix
// * IRIX
// * Linux

template <class T> class A {
  friend class T;  // Not allowed according to the ISO/ANSI C++ std.
};

class B {
public:
  A<B> a;
};

int main() {
  B* b=new B();
  return 0 != b;
}

Regards
- gb -



More information about the Gcc-bugs mailing list