* pt.c (fold_decl_constant_value): Always call fold_non_dependent_expr
at least once.
(tsubst): Use fold_decl_constant_value in place of a bare call to
integral_constant_value.
PR c++/19208
* g++.dg/template/array11.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94006
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-01-21 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/19208
+ * pt.c (fold_decl_constant_value): Always call fold_non_dependent_expr
+ at least once.
+ (tsubst): Use fold_decl_constant_value in place of a bare call to
+ integral_constant_value.
+
2005-01-20 Kazu Hirata <kazu@cs.umass.edu>
* typeck.c (more_qualified_p): Remove.
tree
fold_decl_constant_value (tree expr)
{
- while (true)
+ tree const_expr = expr;
+ do
{
- tree const_expr = integral_constant_value (expr);
- if (expr == const_expr)
- break;
expr = fold_non_dependent_expr (const_expr);
+ const_expr = integral_constant_value (expr);
}
+ while (expr != const_expr);
return expr;
}
/* The array dimension behaves like a non-type template arg,
in that we want to fold it as much as possible. */
max = tsubst_template_arg (omax, args, complain, in_decl);
- if (!processing_template_decl)
- max = integral_constant_value (max);
+ max = fold_decl_constant_value (max);
if (integer_zerop (omax))
{
+2005-01-21 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/19208
+ * g++.dg/template/array11.C: New test.
+
2005-01-20 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.dg/data_char_1.f90: Fix typo, add dg-do directive.
--- /dev/null
+// { dg-do compile }
+// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
+// PR c++/19208: Fold dependent array domains
+
+template <class C> struct if_t { typedef int type; };
+template <class T> struct ffff { static const bool value = true; };
+template <class A>
+struct bound_member_action
+{
+ typedef char f[ffff<A>::value ? 1 : 2];
+ template <class CT>
+ bound_member_action(CT i, typename if_t<f>::type g) {}
+};
+bound_member_action<int> a(0, 1);