[Bug c++/57566] New: [C++11][constexpr] static temporaries bound recursively in reference constant expressions don't get initialized
richard-gccbugzilla at metafoo dot co.uk
gcc-bugzilla@gcc.gnu.org
Sat Jun 8 00:26:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57566
Bug ID: 57566
Summary: [C++11][constexpr] static temporaries bound
recursively in reference constant expressions don't
get initialized
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard-gccbugzilla at metafoo dot co.uk
If a temporary is lifetime-extended by being bound to a reference within a
lifetime-extended temporary, and the complete initializer is a constant
expression, the outer temporary does not get initialized and the inner
temporary does not get emitted. Example:
struct S { int &&a; int b; };
S &&s = { 123, 456 };
GCC emits:
.local _ZGR1s0
.comm _ZGR1s0,16,16
.globl s
.bss
.align 8
.type s, @object
.size s, 8
s:
.zero 8
GCC emits code to dynamically initialize 's.a' to the address of _ZGR1s0. GCC
does not emit any code to initialize _ZGR1s0 itself, nor to initialize s.b.
Both s and the temporaries should be emitted as constants.
More information about the Gcc-bugs
mailing list