diff options
| author | Jason Merrill <jason@redhat.com> | 2009-03-21 16:15:41 -0400 |
|---|---|---|
| committer | Jason Merrill <jason@gcc.gnu.org> | 2009-03-21 16:15:41 -0400 |
| commit | c11655358bd4a0f3dba75e77dc531a9399f37684 (patch) | |
| tree | 632fbc5aeb17457459bfa8833e865a8f2f37a7fd /gcc/cp/parser.c | |
| parent | b39f88bd05693c200851c934fca5ee8d0121173e (diff) | |
| download | gcc-c11655358bd4a0f3dba75e77dc531a9399f37684.zip gcc-c11655358bd4a0f3dba75e77dc531a9399f37684.tar.gz gcc-c11655358bd4a0f3dba75e77dc531a9399f37684.tar.bz2 | |
re PR c++/28879 (ICE with VLA in template function)
PR c++/28879
* parser.c (cp_parser_direct_declarator): In a template, wrap
non-constant expression in NOP_EXPR with TREE_SIDE_EFFECTS set.
* pt.c (tsubst): Preserve it in a partial instantiation.
(dependent_type_p_r): Don't check value_dependent_expression_p.
* decl.c (compute_array_index_type): Don't check
value_dependent_expression_p if TREE_SIDE_EFFECTS.
From-SVN: r144988
Diffstat (limited to 'gcc/cp/parser.c')
| -rw-r--r-- | gcc/cp/parser.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 60787b0..d3343aa 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -13267,6 +13267,13 @@ cp_parser_direct_declarator (cp_parser* parser, &non_constant_p); if (!non_constant_p) bounds = fold_non_dependent_expr (bounds); + else if (processing_template_decl) + { + /* Remember this wasn't a constant-expression. */ + bounds = build_nop (TREE_TYPE (bounds), bounds); + TREE_SIDE_EFFECTS (bounds) = 1; + } + /* Normally, the array bound must be an integral constant expression. However, as an extension, we allow VLAs in function scopes. */ |
