template <typename T> class final { struct workaround { typedef T type; }; friend class workaround::type; final() { }; final( final const& ) { }; }; struct Foo : virtual public final<Foo> {}; void test() { Foo foo; }
$7.1.5.3/2 prohibits such code and Comeau compiler reports an error: error: typedef "type" may not be used in an elaborated type specifier friend class workaround::type; ^ -- Summary: friend accepts template type-parameter. Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28895