https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78367
Bug ID: 78367
Summary: Out-of-line definitions fail to match in-line
declarations with decltype and template arguments
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bugs at qult dot net
Target Milestone: ---
The following code doesn't compile with -std=gnu++11 in any of GCC 4.9.4, 5.4.1
or 6.2.0:
#include <utility>
struct Bar {
void meth(int) {}
};
struct Foo {
template <class T>
decltype(std::declval<Bar>().meth(std::declval<T>()))
call_meth(T v);
};
template <class T>
decltype(std::declval<Bar>().meth(std::declval<T>()))
Foo::call_meth(T v)
{ return Bar{}.meth(v); }
The compile complains that the out-of-line definition doesn't match the in-line
declaration.
This code compiles with Clang.