diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2b7f32fc2ea..a7d8861a32e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-05-28 Jason Merrill + * pt.c (tsubst) [ARRAY_TYPE]: Check for array of array of unknown + bound. + PR c++/61242 * call.c (build_aggr_conv): Ignore passed in flags. (build_array_conv, build_complex_conv): Likewise. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2ebe0159491..0b3cd7f4e51 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12084,7 +12084,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) if (type == TREE_TYPE (t) && domain == TYPE_DOMAIN (t)) return t; - /* These checks should match the ones in grokdeclarator. + /* These checks should match the ones in create_array_type_for_decl. [temp.deduct] @@ -12095,6 +12095,8 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) an abstract class type. */ if (VOID_TYPE_P (type) || TREE_CODE (type) == FUNCTION_TYPE + || (TREE_CODE (type) == ARRAY_TYPE + && TYPE_DOMAIN (type) == NULL_TREE) || TREE_CODE (type) == REFERENCE_TYPE) { if (complain & tf_error) diff --git a/gcc/testsuite/g++.dg/template/array28.C b/gcc/testsuite/g++.dg/template/array28.C new file mode 100644 index 00000000000..18b629d447f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/array28.C @@ -0,0 +1,7 @@ +typedef int (A)[]; + +template void f(T (*)[1]); // { dg-error "array" } + +int main() { + f(0); // { dg-error "no match" } +}