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

Message ID 20210407021913.24020-1-polacek@redhat.com
State New
Headers show
Series
  • [pushed] c++: Add test for Core issue 1376 [PR52202]
Related show

Commit Message

Jason Merrill via Gcc-patches April 7, 2021, 2:19 a.m.
As Jens says in the PR, we handle this correctly.

Tested x86_64-pc-linux-gnu, applying to trunk.

gcc/testsuite/ChangeLog:

	PR c++/52202
	* g++.dg/cpp0x/rv-life.C: New test.
---
 gcc/testsuite/g++.dg/cpp0x/rv-life.C | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/rv-life.C


base-commit: 8cac6af6f8ba5cce69161459e572e59c2be60e75
-- 
2.30.2

Patch

diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-life.C b/gcc/testsuite/g++.dg/cpp0x/rv-life.C
new file mode 100644
index 00000000000..0fd1119d3ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/rv-life.C
@@ -0,0 +1,12 @@ 
+// Core 1376
+// PR c++/52202
+// { dg-do run { target c++11 } }
+
+extern "C" void abort();
+bool x;
+struct T { ~T() { if (!x) abort (); } };
+int main()
+{
+  T&& r = static_cast<T&&>(T());
+  x = true;
+}