Commit 5bbca039 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/40013 (ICE when creating a local array with size from the return value…

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
parent 4fbe73ec
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
......
......@@ -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
......
2009-05-05 Jakub Jelinek <jakub@redhat.com>
PR c++/40013
* g++.dg/ext/vla7.C: New test.
2009-05-04 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/ucnid-11.c, gcc.dg/ucnid-12.c, gcc.dg/ucnid-13.c: New
......
// PR c++/40013
// { dg-options "" }
template <class T>
struct A
{
struct B
{
struct
{
int fn () { return 0; }
} b;
};
void test ();
};
template <class T>
void
A <T>::test ()
{
B a;
int vla[a.b.fn ()];
}
int
main ()
{
A <char> a;
a.test ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment