[Bug c++/61581] New: [C++11] Bogus error: uninitialized const member
ppluzhnikov at google dot com
gcc-bugzilla@gcc.gnu.org
Sat Jun 21 16:53:00 GMT 2014
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).
More information about the Gcc-bugs
mailing list