https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598
Bug ID: 92598
Summary: explicit specialization of template from unnamed
namespace using unqualified-id in enclosing namespace
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sbergman at redhat dot com
Target Milestone: ---
At least with "gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)",
> $ cat test.cc
> namespace { template<typename> class C; }
> template<> class C<void>;
> $ g++ -fsyntax-only -std=c++17 test.cc
> test.cc:2:18: error: explicit specialization of ‘template<class> class
> {anonymous}::C’ outside its namespace must use a nested-name-specifier
> [-fpermissive]
> 2 | template<> class C<void>;
> | ^~~~~~~
That appears to violate the note added with
<http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1838> "Definition
via unqualified-id and using-declaration":
"[Note: An explicit instantiation (17.8.2 [temp.explicit]) or explicit
specialization (17.8.3 [temp.expl.spec]) of a template does not introduce a
name and thus may be declared using an unqualified-id in a member of the
enclosing namespace set, if the primary template is declared in an inline
namespace. —end note]"