public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52202] New: [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type
@ 2012-02-10 21:29 jason at gcc dot gnu.org
  2021-04-06  7:07 ` [Bug c++/52202] " jens.maurer at gmx dot net
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2012-02-10 21:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52202

             Bug #: 52202
           Summary: [C++11][DR 1376] Should not extend lifetime of
                    temporary wrapped in static_cast to reference type
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jason@gcc.gnu.org


// Core 1376                                                                    
// { dg-options -std=c++0x }                                                    

extern "C" void abort();
bool x;
struct T { ~T() { if (x) abort (); } };
int main()
{
  T&& r = static_cast<T&&>(T());
  x = true;
}


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

* [Bug c++/52202] [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type
  2012-02-10 21:29 [Bug c++/52202] New: [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type jason at gcc dot gnu.org
@ 2021-04-06  7:07 ` jens.maurer at gmx dot net
  2021-04-07  2:12 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jens.maurer at gmx dot net @ 2021-04-06  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jens Maurer <jens.maurer at gmx dot net> ---
Core issue 1299 resolved via http://wg21.link/p0727 does in fact
lifetime-extend the temporary in the example.

This bug report should therefore be closed without action.
(If a test case is missing that lifetime-extension does happen, the example
code can have its "abort" condition reversed to suit that purpose.)

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

* [Bug c++/52202] [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type
  2012-02-10 21:29 [Bug c++/52202] New: [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type jason at gcc dot gnu.org
  2021-04-06  7:07 ` [Bug c++/52202] " jens.maurer at gmx dot net
@ 2021-04-07  2:12 ` mpolacek at gcc dot gnu.org
  2021-04-07  2:19 ` cvs-commit at gcc dot gnu.org
  2021-04-07  2:20 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-07  2:12 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'll add the test.

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

* [Bug c++/52202] [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type
  2012-02-10 21:29 [Bug c++/52202] New: [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type jason at gcc dot gnu.org
  2021-04-06  7:07 ` [Bug c++/52202] " jens.maurer at gmx dot net
  2021-04-07  2:12 ` mpolacek at gcc dot gnu.org
@ 2021-04-07  2:19 ` cvs-commit at gcc dot gnu.org
  2021-04-07  2:20 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-07  2:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:a7698c0e1ecad65b1ab651acc82b34e12c7efd35

commit r11-8022-ga7698c0e1ecad65b1ab651acc82b34e12c7efd35
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Apr 6 22:17:33 2021 -0400

    c++: Add test for Core issue 1376 [PR52202]

    As Jens says in the PR, we handle this correctly.

    gcc/testsuite/ChangeLog:

            PR c++/52202
            * g++.dg/cpp0x/rv-life.C: New test.

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

* [Bug c++/52202] [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type
  2012-02-10 21:29 [Bug c++/52202] New: [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type jason at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-04-07  2:19 ` cvs-commit at gcc dot gnu.org
@ 2021-04-07  2:20 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-07  2:20 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Done.

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

end of thread, other threads:[~2021-04-07  2:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 21:29 [Bug c++/52202] New: [C++11][DR 1376] Should not extend lifetime of temporary wrapped in static_cast to reference type jason at gcc dot gnu.org
2021-04-06  7:07 ` [Bug c++/52202] " jens.maurer at gmx dot net
2021-04-07  2:12 ` mpolacek at gcc dot gnu.org
2021-04-07  2:19 ` cvs-commit at gcc dot gnu.org
2021-04-07  2:20 ` mpolacek 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).