public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tobias.anderberg at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/54998] New: Internal compiler error with union member initialization using default constructor
Date: Sat, 20 Oct 2012 12:25:00 -0000	[thread overview]
Message-ID: <bug-54998-4@http.gcc.gnu.org/bugzilla/> (raw)


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.


             reply	other threads:[~2012-10-20 12:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20 12:25 tobias.anderberg at gmail dot com [this message]
2012-10-20 23:03 ` [Bug c++/54998] " paolo.carlini at oracle dot com
2013-07-04 10:12 ` paolo.carlini at oracle dot com
2013-07-04 10:27 ` paolo.carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-54998-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).