diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist80.C | 6 |
3 files changed, 16 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f04144..8a2cb16 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-02-21 Jason Merrill <jason@redhat.com> + DR 1591 + PR c++/60051 + * pt.c (unify): Only unify if deducible. Handle 0-length list. + PR c++/60250 * parser.c (cp_parser_direct_declarator): Don't wrap a type-dependent expression in a NOP_EXPR. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4cf387a..0f576a5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -17262,14 +17262,16 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, explain_p); } - if (TREE_CODE (parm) == ARRAY_TYPE) + if (TREE_CODE (parm) == ARRAY_TYPE + && deducible_array_bound (TYPE_DOMAIN (parm))) { /* Also deduce from the length of the initializer list. */ tree max = size_int (CONSTRUCTOR_NELTS (arg)); tree idx = compute_array_index_type (NULL_TREE, max, tf_none); - if (TYPE_DOMAIN (parm) != NULL_TREE) - return unify_array_domain (tparms, targs, TYPE_DOMAIN (parm), - idx, explain_p); + if (idx == error_mark_node) + return unify_invalid (explain_p); + return unify_array_domain (tparms, targs, TYPE_DOMAIN (parm), + idx, explain_p); } /* If the std::initializer_list<T> deduction worked, replace the diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist80.C b/gcc/testsuite/g++.dg/cpp0x/initlist80.C new file mode 100644 index 0000000..7947f1f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist80.C @@ -0,0 +1,6 @@ +// PR c++/60051 +// { dg-require-effective-target c++11 } + +#include <initializer_list> + +auto x[2] = {}; // { dg-error "" } |