public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57566] New: [C++11][constexpr] static temporaries bound recursively in reference constant expressions don't get initialized
@ 2013-06-08  0:26 richard-gccbugzilla at metafoo dot co.uk
  2021-08-09 19:30 ` [Bug c++/57566] [C++11] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2013-06-08  0:26 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/57566] [C++11] static temporaries bound recursively in reference constant expressions don't get initialized
  2013-06-08  0:26 [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
@ 2021-08-09 19:30 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 5+.
Maybe by r5-5022.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-09 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-08  0:26 [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
2021-08-09 19:30 ` [Bug c++/57566] [C++11] " pinskia at gcc dot gnu.org

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).