diff options
author | Jason Merrill <jason@redhat.com> | 2018-05-14 10:49:45 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-05-14 10:49:45 -0400 |
commit | 403962eac2c99fc7510fbd4164f0a56fb7a15d0c (patch) | |
tree | eea7a98609a76102c16b62cf557dcee6cb9af004 /gcc/cp | |
parent | 3846b8e4b37aabba4c85d14078d041020d363fb8 (diff) | |
download | gcc-403962eac2c99fc7510fbd4164f0a56fb7a15d0c.zip gcc-403962eac2c99fc7510fbd4164f0a56fb7a15d0c.tar.gz gcc-403962eac2c99fc7510fbd4164f0a56fb7a15d0c.tar.bz2 |
pt.c (tsubst): Check valid_array_size_p.
* pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
(tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
gcc/c-family/
* c-common.c (valid_array_size_p): Add complain parameter.
* c-common.h: ...which defaults to true.
From-SVN: r260227
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 08cd81f..7450598 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-05-14 Jason Merrill <jason@redhat.com> + + * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p. + (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl. + 2018-05-11 Jakub Jelinek <jakub@redhat.com> PR c/85696 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 790d6ea..cd9011b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14788,6 +14788,10 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) r = build_cplus_array_type (type, domain); + if (!valid_array_size_p (input_location, r, in_decl, + (complain & tf_error))) + return error_mark_node; + if (TYPE_USER_ALIGN (t)) { SET_TYPE_ALIGN (r, TYPE_ALIGN (t)); @@ -18147,6 +18151,9 @@ tsubst_copy_and_build (tree t, } } + /* Avoid passing an enclosing decl to valid_array_size_p. */ + in_decl = NULL_TREE; + tree op1 = tsubst (TREE_OPERAND (t, 1), args, complain, in_decl); tree op2 = RECUR (TREE_OPERAND (t, 2)); ret = build_new (&placement_vec, op1, op2, &init_vec, |