https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81188
Bug ID: 81188 Summary: decltype(this->member()) raises invalid prototype Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: serge.guel...@telecom-bretagne.eu Target Milestone: --- Compiling the following test case ``` template <class F> struct C { F fast(long i) const; auto operator[](long i) const -> decltype(this->fast(i)); }; template <class F> auto C<F>::operator[](long i) const -> decltype(this->fast(i)) { return fast(i); } ``` with ``` g++ -std=c++11 -c a.cpp ``` raises the following unexpected error message ``` a.cpp:8:6: error: prototype for ‘decltype (((const C<F>*)this)->C<F>::fast(i)) C<F>::operator[](long int) const’ does not match any in class ‘C<F>’ auto C<F>::operator[](long i) const -> decltype(this->fast(i)) { ^~~~ a.cpp:4:8: error: candidate is: decltype (((const C<F>*)this)->C<F>::fast(i)) C<F>::operator[](long int) const auto operator[](long i) const -> decltype(this->fast(i)); ``` Removing the ``this->`` in the decltype fixes the issue, but this is a regression compared to g++-6 and clang++.