diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-05-05 08:37:05 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-05-05 08:37:05 +0200 |
commit | 5bbca03966e06a79f5dd06166f6998369256efa9 (patch) | |
tree | 72b24ae5789cf19e7d30d4fbc03c4a8a4c874f11 /gcc/cp | |
parent | 4fbe73ec8080aad23ad62972d7a05565ecadd0bc (diff) | |
download | gcc-5bbca03966e06a79f5dd06166f6998369256efa9.zip gcc-5bbca03966e06a79f5dd06166f6998369256efa9.tar.gz gcc-5bbca03966e06a79f5dd06166f6998369256efa9.tar.bz2 |
re PR c++/40013 (ICE when creating a local array with size from the return value of a member function of an object in a nested class in a template class)
PR c++/40013
* pt.c (tsubst): If magic NOP_EXPR with side-effects has no type,
set it from its operand's type after tsubst_expr.
* g++.dg/ext/vla7.C: New test.
From-SVN: r147119
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4a34132..808f0b0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2009-05-05 Jakub Jelinek <jakub@redhat.com> + + PR c++/40013 + * pt.c (tsubst): If magic NOP_EXPR with side-effects has no type, + set it from its operand's type after tsubst_expr. + 2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/28152 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4844333..adea7eb 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9182,6 +9182,14 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) max = tsubst_expr (omax, args, complain, in_decl, /*integral_constant_expression_p=*/false); + + /* Fix up type of the magic NOP_EXPR with TREE_SIDE_EFFECTS if + needed. */ + if (TREE_CODE (max) == NOP_EXPR + && TREE_SIDE_EFFECTS (omax) + && !TREE_TYPE (max)) + TREE_TYPE (max) = TREE_TYPE (TREE_OPERAND (max, 0)); + max = fold_decl_constant_value (max); /* If we're in a partial instantiation, preserve the magic NOP_EXPR |