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

            Bug ID: 82980
           Summary: Regression in determination of current instantiation
                    (invalid requirement of template keyword)
           Product: gcc
           Version: 8.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: ---

Consider this example (reduced from SO:
https://stackoverflow.com/q/47261553/2069064)

template <class T>
struct Outer
{
    template <class U>
    void f();

    void bar(Outer outer) {
        [outer](){ outer.f<int>(); }; // error
    }
};

int main() { }

outer is an instance of the current instantiation, so outer.f isn't type
dependent, so the template keyword shouldn't be required. However, gcc 7 and
later diagnose:

prog.cc: In lambda function:
prog.cc:8:28: error: expected primary-expression before 'int'
         [outer](){ outer.f<int>(); };
                            ^~~
prog.cc:8:28: error: expected ';' before 'int'

gcc 6.3 and earlier accept, as does clang.

Reply via email to