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++/55240] New: [c++0x] ICE on non-static data member initialization using 'auto' variable from containing function


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: unassigned@gcc.gnu.org
        ReportedBy: bisqwit@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


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