https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71825
Bug ID: 71825 Summary: incorrectly rejects valid C++ code with a template class inside a namespace Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The code is accepted by both Clang and MSVC. The issue seems to do with the wrong name lookup for A in the constructor definition. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160709 (experimental) [trunk revision 238191] (GCC) $ $ clang++-3.8 -c small.cpp $ $ g++-trunk -c small.cpp small.cpp:8:6: error: expected unqualified-id before ‘)’ token A () {} ^ $ -------------------------------------- namespace N { template < class > struct A; } template < class A > struct N::A { A () {} };