c++: Add test for PR90199.
authorMarek Polacek <polacek@redhat.com>
Sun, 20 Sep 2020 19:25:55 +0000 (15:25 -0400)
committerMarek Polacek <polacek@redhat.com>
Sun, 20 Sep 2020 19:26:52 +0000 (15:26 -0400)
Fixed by r11-2998, which fixed this ICE too.

gcc/testsuite/ChangeLog:

PR c++/90199
* g++.dg/cpp1y/constexpr-90199.C: New test.

gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C
new file mode 100644 (file)
index 0000000..0e3f2be
--- /dev/null
@@ -0,0 +1,28 @@
+// PR c++/90199
+// { dg-do compile { target c++14 } }
+// { dg-additional-options "-frounding-math" }
+
+template <typename>
+class complex;
+
+template <typename D7> constexpr complex<D7>
+operator+ (complex<D7> hd, complex<D7> qc)
+{
+  hd += qc;
+  return hd;
+}
+
+template <>
+class complex<float> {
+public:
+  constexpr complex
+  operator+= (complex rm)
+  {
+    jp += rm.jp;
+    return *this;
+  }
+
+  _Complex float jp;
+};
+
+constexpr complex<float> fl{3.3}, ka{1.1}, r0 = fl + ka;