This code has erroneously been accepted since at least gcc 2.95: -------------------------- namespace NS { template <int A, int B> class X {}; }
class Y { template <int> friend class NS::X; }; -------------------------- Note the wrong number of template arguments in the friend declaration. The code is correctly rejected if X is not in a namespace. W. -- Summary: Invalid template friend declaration accepted Product: gcc Version: 4.3.2 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bangerth at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39269