re PR c++/66427 (The compiler rejects too complex variable templates)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 4 Aug 2015 11:05:02 +0000 (11:05 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 4 Aug 2015 11:05:02 +0000 (11:05 +0000)
2015-08-04  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/66427
* g++.dg/cpp1y/var-templ34.C: New.

From-SVN: r226568

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/var-templ34.C [new file with mode: 0644]

index 37b41687abafd1edc498ac50d484786791d7abc8..fb22e07ed6e0d38e3568e76ca87b149e41968498 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/66427
+       * g++.dg/cpp1y/var-templ34.C: New.
+
 2015-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * gcc.target/aarch64/pragma_cpp_predefs_1.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ34.C b/gcc/testsuite/g++.dg/cpp1y/var-templ34.C
new file mode 100644 (file)
index 0000000..0c39dd9
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/66427
+// { dg-do compile { target c++14 } }
+
+template<typename T>
+struct complex {};
+
+struct plus {};
+struct multiplies {};
+
+template<typename T, typename Op>
+constexpr T identity_element;
+
+template<>
+constexpr int identity_element<int, plus> = 0;
+
+template<typename T>
+constexpr complex<T> identity_element<complex<T>, plus> = {
+    identity_element<T, plus>,
+    identity_element<T, plus>
+};