http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51786
Bug #: 51786
Summary: [c++0x] Invalid declaration with decltype accepted
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The error message "declaration does not declare anything" is not
triggered in certain cases when using decltype:
===================================
struct A {};
void foo() { decltype(A()); }
===================================
It *is* triggered if I write decltype(int) instead.
Another testcase is the following:
===================================
template<int> struct A
{
A() { decltype(this); }
};
A<0> a;
===================================
It *is* triggered if I make A a non-template class.
This bug is similar to PR21120 where the same problems occured with "typeof".