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

            Bug ID: 79394
           Summary: Possible rejects-valid problem
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

class A {
  int m_class;
};
template <class> class B : A { void m_fn1(); };
template <class T> void B<T>::m_fn1() { foo (this->m_class); }

isn't compiled anymore since r236221.  clang++ accepts the code.
g++ says
p.cc: In member function ‘void B< <template-parameter-1-1> >::m_fn1()’:
p.cc:5:41: error: there are no arguments to ‘foo’ that depend on a template
parameter, so a declaration of ‘foo’ must be available [-fpermissive]
 template <class T> void B<T>::m_fn1() { foo (this->m_class); }
                                         ^~~
p.cc:5:41: note: (if you use ‘-fpermissive’, G++ will accept your code, but
allowing the use of an undeclared name is deprecated)


It is likely that the code is actually invalid, in which case we should
document this in porting_to.html and close this PR.

Reply via email to