re PR c++/19208 (Spurious error about variably modified type)

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.

	PR c++/19208
	* g++.dg/template/array11.C: New test.

From-SVN: r94006
This commit is contained in:
Giovanni Bajo 2005-01-21 02:27:16 +00:00
parent 3eacd71fc1
commit 4ef69b8352
4 changed files with 32 additions and 6 deletions

View File

@ -1,3 +1,11 @@
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.

View File

@ -3332,13 +3332,13 @@ fold_non_dependent_expr (tree expr)
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;
}
@ -6970,8 +6970,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/* 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))
{

View File

@ -1,3 +1,8 @@
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.

View File

@ -0,0 +1,14 @@
// { 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);