[Bug c++/92776] New: Can't define member function out of line with non-type template parameter

barry.revzin at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Dec 3 19:04:00 GMT 2019


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

            Bug ID: 92776
           Summary: Can't define member function out of line with non-type
                    template parameter
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

From StackOverflow (https://stackoverflow.com/q/59163716/2069064):

struct A {};

template <A a>
struct B {
    void f();
};

template <A a>
void B<a>::f() { }

On the gcc trunk on godbolt, this fails with:

<source>:9:14: error: invalid use of incomplete type 'struct B<((const A)a)>'
    9 | void B<a>::f() { }
      |              ^
<source>:4:8: note: declaration of 'struct B<((const A)a)>'
    4 | struct B {
      |        ^

But compiles fine if you replace the declaration of A with something like
"using A = int;"


More information about the Gcc-bugs mailing list