[Bug c++/54336] New: [c++0x] diagnostics for functions with arg-dependent return types have bad signatures
luto at mit dot edu
gcc-bugzilla@gcc.gnu.org
Mon Aug 20 22:37:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54336
Bug #: 54336
Summary: [c++0x] diagnostics for functions with arg-dependent
return types have bad signatures
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: luto@mit.edu
This code:
template<typename T> auto func(T x) -> decltype(x.method())
{
static_assert(false, "test");
}
fails to compile with:
decltype_return.cc: In function 'decltype (x.method()) func(T)':
decltype_return.cc:3:3: error: static assertion failed: test
static_assert(false, "test");
^
What's 'decltype (x.method()) func(T)'? x isn't defined. 'auto func(T x) ->
decltype(x.method())' or even 'decltype (x.method()) func (T x)' would be
better.
More information about the Gcc-bugs
mailing list