@@ -26494,6 +26494,8 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain)
targs = template_parms_to_args (tparms);
fparms = tsubst_arg_types (fparms, tsubst_args, NULL_TREE,
complain, ctor);
+ if (fparms == error_mark_node)
+ ok = false;
fargs = tsubst (fargs, tsubst_args, complain, ctor);
if (ci)
ci = tsubst_constraint_info (ci, tsubst_args, complain, ctor);
new file mode 100644
@@ -0,0 +1,23 @@
+// { dg-do compile { target c++17 } }
+
+template<class, int>
+struct Array {};
+
+template<class T, int size_>
+struct Foo {
+ static constexpr int size() {
+ return size_;
+ }
+
+ template<class U>
+ Foo(U, Array<T, size()>) {}
+};
+
+template<class T, int size, class U>
+Foo(U, Array<T, size>) -> Foo<T, size>;
+
+int main() {
+ Array<int, 2> arr{};
+
+ Foo foo{2.0, arr};
+}
@@ -8023,6 +8023,8 @@ build_function_type (tree value_type, tree arg_types)
bool any_structural_p, any_noncanonical_p;
tree canon_argtypes;
+ gcc_assert (arg_types != error_mark_node);
+
if (TREE_CODE (value_type) == FUNCTION_TYPE)
{
error ("function return type cannot be function");