From 0968df43cdd7cbb154c021cd32a7cac25a19aff7 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sun, 20 Sep 2020 15:25:55 -0400 Subject: [PATCH] c++: Add test for PR90199. 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 | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C new file mode 100644 index 00000000000..0e3f2be08d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C @@ -0,0 +1,28 @@ +// PR c++/90199 +// { dg-do compile { target c++14 } } +// { dg-additional-options "-frounding-math" } + +template +class complex; + +template constexpr complex +operator+ (complex hd, complex qc) +{ + hd += qc; + return hd; +} + +template <> +class complex { +public: + constexpr complex + operator+= (complex rm) + { + jp += rm.jp; + return *this; + } + + _Complex float jp; +}; + +constexpr complex fl{3.3}, ka{1.1}, r0 = fl + ka; -- 2.30.2