My fix for c++/60223 (ICE with T{} in non-deduced context) fixed these three
tests also.  Yay!

Tested on x86_64-linux, applying to trunk.

2019-06-22  Marek Polacek  <pola...@redhat.com>

        PR c++/65707
        PR c++/89480
        PR c++/58836
        * g++.dg/cpp0x/nondeduced5.C: New test.
        * g++.dg/cpp0x/nondeduced6.C: New test.
        * g++.dg/cpp0x/nondeduced7.C: New test.

diff --git gcc/testsuite/g++.dg/cpp0x/nondeduced5.C 
gcc/testsuite/g++.dg/cpp0x/nondeduced5.C
new file mode 100644
index 00000000000..dd890ec4b69
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/nondeduced5.C
@@ -0,0 +1,12 @@
+// PR c++/65707
+// { dg-do compile { target c++11 } }
+
+template <int a> struct b {
+  typedef int c;
+  constexpr operator c() { return a; }
+};
+template <bool> struct d;
+template <typename> struct e : b<true> {};
+template <typename, typename = d<true>> struct f;
+template <typename g> struct f<g, d<e<g>{}>> {};
+template struct f<int>;
diff --git gcc/testsuite/g++.dg/cpp0x/nondeduced6.C 
gcc/testsuite/g++.dg/cpp0x/nondeduced6.C
new file mode 100644
index 00000000000..9f68e304f03
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/nondeduced6.C
@@ -0,0 +1,24 @@
+// PR c++/89480
+// { dg-do compile { target c++11 } }
+
+template <typename Foo, Foo Part>
+struct TSelect {};
+
+enum What {
+    The
+};
+
+template <typename Foo>
+struct AnotherOneSelector {
+    static constexpr Foo Id = Foo::The;
+};
+
+template <typename Foo, typename SelectPartType>
+struct THelper;
+
+template <typename Foo>
+struct THelper<Foo, TSelect<Foo, Foo{AnotherOneSelector<Foo>::Id}>> {};
+
+int main() {
+    THelper<What, TSelect<What, What::The>> t;
+}
diff --git gcc/testsuite/g++.dg/cpp0x/nondeduced7.C 
gcc/testsuite/g++.dg/cpp0x/nondeduced7.C
new file mode 100644
index 00000000000..a8aa073c57e
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/nondeduced7.C
@@ -0,0 +1,6 @@
+// PR c++/58836
+// { dg-do compile { target c++11 } }
+
+template<typename, int> struct A;
+template<typename T> struct A<T, T{}> {}; // { dg-error "partial 
specialization" }
+A<int, 0> a;

Reply via email to