This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/54864] New: Decltype in nested class


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]