From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10082 invoked by alias); 8 Jun 2013 00:26:16 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9405 invoked by uid 48); 8 Jun 2013 00:26:09 -0000 From: "richard-gccbugzilla at metafoo dot co.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57566] New: [C++11][constexpr] static temporaries bound recursively in reference constant expressions don't get initialized Date: Sat, 08 Jun 2013 00:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: richard-gccbugzilla at metafoo dot co.uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00399.txt.bz2 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.