https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111872

            Bug ID: 111872
           Summary: GCC rejects out of class definition of inner private
                    class template
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following valid(afaik) code is rejected by gcc but accepted by clang and
msvc. 
https://godbolt.org/z/x5xMvETPh
```
class A {

        struct N;

        template<const N* K> struct S; 
};
// works now

class A::N{};
template<const A::N* K> class  A::S{};//gcc rejects this but clang and msbc
accepts this
```

GCC says:

<source>:10:19: error: 'class A::N' is private within this context
   10 | template<const A::N* K> class  A::S{};//gcc rejects this but clang and
msbc accepts this
      |                   ^
<source>:9:10: note: declared private here
    9 | class A::N{};
      |          ^

Reply via email to