This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54864] New: Decltype in nested class
- From: "zeratul976 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 09 Oct 2012 07:38:06 +0000
- Subject: [Bug c++/54864] New: Decltype in nested class
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54864
Bug #: 54864
Summary: Decltype in nested class
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: zeratul976@hotmail.com
The following code:
struct S
{
int foo();
struct nested
{
S* outer;
auto bar() -> decltype(outer->foo());
};
};
fails to compile with the following errors:
test.cpp:9:37: error: invalid use of incomplete type 'struct S'
auto bar() -> decltype(outer->foo());
^
test.cpp:1:8: error: forward declaration of 'struct S'
struct S
^
test.cpp:9:37: error: invalid use of incomplete type 'struct S'
auto bar() -> decltype(outer->foo());
^
test.cpp:1:8: error: forward declaration of 'struct S'
struct S
^
I believe this code is valid. It is accepted by clang trunk.
Tested with gcc-4.8-20121007.