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

            Bug ID: 91754
           Summary: [c++2a] Defining member function outside of class body
                    fails to compile when containing class is templated on
                    class-type NTTP
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: beachboy44 at me dot com
  Target Milestone: ---

https://godbolt.org/z/OQHx2M

The following code fails to compile:

    struct S {}; // error occurs regardless of whether or not S is empty

    template<S s>
    struct T
    {
        T(); // declare ctor or mem fn
    };

    template<S s>
    inline T<s>::T() {} // define ctor or mem fn

error: invalid use of incomplete type 'struct T<((const S)s)>'


However, defining the ctor or mem fn inside the class body compiles.

Reply via email to