PR c++/73456 - ICE with constrained parameter pack.
authorJason Merrill <jason@redhat.com>
Thu, 11 Aug 2016 15:43:12 +0000 (11:43 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 11 Aug 2016 15:43:12 +0000 (11:43 -0400)
* logic.cc (non_atomic_constraint_p): Handle EXPR_PACK_EXPANSION.

From-SVN: r239376

gcc/cp/ChangeLog
gcc/cp/logic.cc
gcc/testsuite/g++.dg/concepts/variadic4.C [new file with mode: 0644]

index 647b3e65800a12f1163d888353dda5c08d1b6d69..04d6aa0ccbf09f12ffc6d3316bc240c0536ca9f0 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/73456
+       * logic.cc (non_atomic_constraint_p): Handle EXPR_PACK_EXPANSION.
+
 2016-08-10  Jason Merrill  <jason@redhat.com>
 
        Implement C++17 constexpr if.
index dda98dfc310b4520e3facab77fb2ad1cea48aa3b..b86e740e7c39d5de611789aba8136881bdc36655 100644 (file)
@@ -305,6 +305,9 @@ non_atomic_constraint_p (tree t)
     case ICONV_CONSTR:
     case DEDUCT_CONSTR:
     case EXCEPT_CONSTR:
+      /* A pack expansion isn't atomic, but it can't decompose to prove an
+        atom, so it shouldn't cause analyze_atom to return undecided.  */
+    case EXPR_PACK_EXPANSION:
       return false;
     case CHECK_CONSTR:
     case PARM_CONSTR:
diff --git a/gcc/testsuite/g++.dg/concepts/variadic4.C b/gcc/testsuite/g++.dg/concepts/variadic4.C
new file mode 100644 (file)
index 0000000..d20fa7d
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/73456
+// { dg-options "-std=c++1z -fconcepts" }
+
+template<typename...> struct list {};
+
+template<typename Seq>
+concept bool Sequence = true;
+
+template<Sequence... Seqs>
+struct zip;
+
+template<Sequence... Seqs>
+    requires requires { typename list<Seqs...>; }
+// main.cpp:12:8: internal compiler error: in non_atomic_constraint_p, at cp/logic.cc:315
+struct zip<Seqs...> {};
+
+int main()
+{
+    zip<list<>, list<int>> {};
+}