http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55240



             Bug #: 55240

           Summary: [c++0x] ICE on non-static data member initialization

                    using 'auto' variable from containing function

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: bisq...@iki.fi





This code causes an ICE in GCC 4.7.1 and 4.7.2:



int main()

{

    int q = 1;

    struct test { int x = q; } instance;

}



tmpq.cc: In constructor 'constexpr main()::test::test()':

tmpq.cc:4:12: internal compiler error: in expand_expr_real_1, at expr.c:9122



It is notable that if the code is written like this, the error message changes.



int main()

{

    int q = 1;

    struct test { int x; test():x(q){} } instance;

}



tmpq.cc:5:35: error: use of 'auto' variable from containing function

tmpq.cc:3:9: error:   'int q' declared here

Reply via email to