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++/54998] New: Internal compiler error with union member initialization using default constructor


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

             Bug #: 54998
           Summary: Internal compiler error with union member
                    initialization using default constructor
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tobias.anderberg@gmail.com


class Foo {
public:
private:
    static const int kRows = 4;
    static const int kCols = 4;

    union {
        float m_n[kRows][kCols];
        float m_m[kRows * kCols] = {
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        };
    };
};

int main()
{
    Foo myFoo;
    return 0;
}

Compile: g++ -std=c++11 foo.cc

Result:

foo.cc: In constructor âconstexpr Foo::Foo()â:
foo.cc:1:7: internal compiler error: in cx_check_missing_mem_inits, at
cp/semantics.c:6166
 class Foo {
       ^

foo.cc:1:7: internal compiler error: Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
Abort trap: 6

System:
Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012;
root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64

GCC build command: ./configure --enable-languages=c,c++

g++ --version
g++ (GCC) 4.8.0 20121020 (experimental)

Additional notes:
By either naming the union, or supplying a default constructor the sample
compiles.


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