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: unassig...@gcc.gnu.org

        ReportedBy: zeratul...@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.

Reply via email to