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

            Bug ID: 85731
           Summary: [8/9 Regression] Inner class method declaration
                    changes meaning of outer template class template
                    method
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jaak at ristioja dot ee
  Target Milestone: ---

The following code compiles with GCC 7.3.0 and earlier, but errors with GCC
8.1.0 and trunk.

    template <typename T>
    struct Outer {
        struct Inner;
        template <int I> static void f();
    };

    template <typename T>
    struct Outer<T>::Inner {
        decltype(Outer<T>::f<42>()) f();
    };

    int main() { Outer<int>::Inner().f(); }


<source>: In instantiation of 'struct Outer<int>::Inner':
<source>:12:36:   required from here
<source>:8:28: error: declaration of 'decltype (f<42>()) Outer<T>::Inner::f()
[with T = int; decltype (f<42>()) = void]' [-fpermissive]
     struct Outer<T>::Inner {
                            ^
<source>:4:38: error: changes meaning of 'f' from 'static void Outer<T>::f()
[with int I = I; T = int]' [-fpermissive]
         template <int I> static void f();
                                      ^

Reply via email to