https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61581

            Bug ID: 61581
           Summary: [C++11] Bogus error: uninitialized const member
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/15789654

Fails with current trunk, and all older versions I've tried.

g++ -c t.cc -std=c++11
t.cc: In function 'void Bar()':
t.cc:9:11: error: uninitialized const member 'Foo::b'
   Fn( {1} );
           ^

/// -- cut ---
struct Foo {
  long a;
  const long b;
};

void Fn(const Foo&);

void Bar() {
  Fn( {1} );
}
/// -- cut ---

Removing 'const' and examining assembly shows that GCC *does* initialize 'b' to
0 (as it should).

Reply via email to