This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51786] New: [c++0x] Invalid declaration with decltype accepted
- From: "reichelt at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 07 Jan 2012 16:16:25 +0000
- Subject: [Bug c++/51786] New: [c++0x] Invalid declaration with decltype accepted
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: reichelt@gcc.gnu.org
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".