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
+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
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
--- /dev/null
+// 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 ();
+}