http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57543

Daniel Frey <d.frey at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d.frey at gmx dot de

--- Comment #2 from Daniel Frey <d.frey at gmx dot de> ---
Here's another short example which seems to expose the same bug:

template< typename > struct X
{
  void foo() {}

  auto bar() -> decltype( X::foo() ) //1
  {
    return foo();
  }
};

int main()
{
  X<int>().bar();
}

Note that the decltype in //1 causes the problem, not the body of the function.
Changing //1 to decltype(foo()) fails with the same error message, changing it
to either decltype(this->foo()) or decltype(std::declval<X>().foo()) solves the
problem and GCC accepts the code. Also note that Clang compiles all versions
just fine.

The bug seems to occur in unevaluated contexts and only for templates. If you
change the above class X to be a non-template GCC accepts the code as well.

Reply via email to