public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1589] c++: add NRV testcase [PR58050]
@ 2023-06-07  1:33 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2023-06-07  1:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4fe84e2a4c0b600d2bc01f171b3b9dd1f4357208

commit r14-1589-g4fe84e2a4c0b600d2bc01f171b3b9dd1f4357208
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Jun 6 12:01:23 2023 -0400

    c++: add NRV testcase [PR58050]
    
    This was fixed in GCC 10.
    
            PR c++/58050
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/opt/nrv24.C: New test.

Diff:
---
 gcc/testsuite/g++.dg/opt/nrv24.C | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gcc/testsuite/g++.dg/opt/nrv24.C b/gcc/testsuite/g++.dg/opt/nrv24.C
new file mode 100644
index 00000000000..7a7a59b26f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/nrv24.C
@@ -0,0 +1,18 @@
+// PR c++/58050
+// { dg-do link }
+
+struct B {
+  B() { }
+  B(const B&); // not defined, link error on unnecessary copy
+  ~B() { }
+};
+struct A {
+  static B make() { return B(); }
+} a;
+A *ap() { return &a; }
+int main () {
+  {B b = A::make();}
+  {B B = a.make();}
+  {B b = ap()->make();}
+  {B b = A().make();}
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-07  1:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07  1:33 [gcc r14-1589] c++: add NRV testcase [PR58050] Jason Merrill

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