We were crashing because invalid_nontype_parm_type_p allowed _Complex
template parms, but convert_nontype_argument didn't know what to do for
them. Let's just disallow it, people can and should use std::complex
instead.
PR c++/100634
gcc/cp/ChangeLog:
* pt.c (invalid_nontype_parm_type_p): Return true for COMPLEX_TYPE.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/nontype-complex1.C: New test.
else if (cxx_dialect >= cxx11
&& TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM)
return false;
+ else if (TREE_CODE (type) == COMPLEX_TYPE)
+ /* Fall through. */;
else if (VOID_TYPE_P (type))
/* Fall through. */;
else if (cxx_dialect >= cxx20)
--- /dev/null
+// PR c++/100634
+// { dg-do compile { target c++20 } }
+// { dg-options "" }
+
+// We could support _Complex template arguments, but better I think to make
+// people use a standard type instead.
+template<_Complex int> struct ComplexInt {}; // { dg-error "not a valid type" }
+using CI = ComplexInt<1 + 3i>;