[committed] Add testcase for already fixed PR c++/86953

Jakub Jelinek jakub@redhat.com
Tue Apr 16 19:39:00 GMT 2019


Hi!

The following PR has been fixed by the changes to evaluate constexpr
functions on pre-folding/genericization trees.

I've tested the following testcase on x86_64-linux and committed to trunk as
obvious, so that we don't regress it.

2019-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR c++/86953
	* g++.dg/cpp0x/constexpr-86953.C: New test.

--- gcc/testsuite/g++.dg/cpp0x/constexpr-86953.C.jj	2019-04-16 15:55:53.938063633 +0200
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-86953.C	2019-04-16 15:55:48.072160330 +0200
@@ -0,0 +1,19 @@
+// PR c++/86953
+// { dg-do run { target c++11 } }
+// { dg-options "-O2" }
+
+struct B {
+  double x;
+  bool y, z;
+  constexpr bool operator== (const B& o) const noexcept
+  {
+    return x == o.x && y == o.y && z == o.z;
+  }
+  constexpr bool operator!= (const B& o) const noexcept { return !(*this == o); }
+};
+
+int
+main ()
+{
+  bool b = B{} == B{};
+}

	Jakub



More information about the Gcc-patches mailing list