-2004-12-22 Mark Mitchell <mark@codesourcery.com>
+2005-05-01 Mark Mitchell <mark@codesourcery.com>
+ Backport:
+ 2005-02-22 Mark Mitchell <mark@codesourcery.com>
+ PR c++/19991
+ * init.c (decl_constant_value): Iterate if the value of a decl
+ is itself a constant.
+
+2005-05-01 Mark Mitchell <mark@codesourcery.com>
+
+ Backport:
+ 2004-12-22 Mark Mitchell <mark@codesourcery.com>
PR c++/18464
* call.c (build_this): In templates, do not bother with
build_unary_op.
TREE_OPERAND (decl, 0), d1, d2);
}
- if (DECL_P (decl)
- && (/* Enumeration constants are constant. */
- TREE_CODE (decl) == CONST_DECL
- /* And so are variables with a 'const' type -- unless they
- are also 'volatile'. */
- || CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl)))
- && DECL_INITIAL (decl)
- && DECL_INITIAL (decl) != error_mark_node
- /* This is invalid if initial value is not constant.
- If it has either a function call, a memory reference,
- or a variable, then re-evaluating it could give different results. */
- && TREE_CONSTANT (DECL_INITIAL (decl))
- /* Check for cases where this is sub-optimal, even though valid. */
- && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR)
- return DECL_INITIAL (decl);
+ while (DECL_P (decl)
+ && (/* Enumeration constants are constant. */
+ TREE_CODE (decl) == CONST_DECL
+ /* And so are variables with a 'const' type -- unless they
+ are also 'volatile'. */
+ || CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl)))
+ && DECL_INITIAL (decl)
+ && DECL_INITIAL (decl) != error_mark_node
+ /* This is invalid if initial value is not constant. If it
+ has either a function call, a memory reference, or a
+ variable, then re-evaluating it could give different
+ results. */
+ && TREE_CONSTANT (DECL_INITIAL (decl))
+ /* Check for cases where this is sub-optimal, even though
+ valid. */
+ && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR)
+ decl = DECL_INITIAL (decl);
return decl;
}
\f
+2005-05-01 Mark Mitchell <mark@codesourcery.com>
+
+ Backport:
+ 2005-02-22 Mark Mitchell <mark@codesourcery.com>
+ PR c++/19991
+ * g++.dg/parse/constant7.C: New test.
+
2005-05-02 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/titype-1.c: Fix dg-error target regexp.
* gcc.dg/uninit-C.c: Likewise.
-2004-12-22 Mark Mitchell <mark@codesourcery.com>
+2005-05-01 Mark Mitchell <mark@codesourcery.com>
+ Backport:
+ 2004-12-22 Mark Mitchell <mark@codesourcery.com>
PR c++/18464
* g++.dg/template/cond5.C: New test.