* pt.c (build_non_dependent_expr): Don't check null_ptr_cst_p,
do call maybe_constant_value in C++0x mode.
* semantics.c (cxx_eval_constant_expression): Handle TEMPLATE_DECL.
From-SVN: r173679
2011-05-11 Jason Merrill <jason@redhat.com>
+ * pt.c (build_non_dependent_expr): Don't check null_ptr_cst_p,
+ do call maybe_constant_value in C++0x mode.
+ * semantics.c (cxx_eval_constant_expression): Handle TEMPLATE_DECL.
+
PR c++/48745
* pt.c (value_dependent_expr_p): Handle CONSTRUCTOR.
{
tree inner_expr;
- /* Preserve null pointer constants so that the type of things like
- "p == 0" where "p" is a pointer can be determined. */
- if (null_ptr_cst_p (expr))
- return expr;
+#ifdef ENABLE_CHECKING
+ /* Try to get a constant value for all non-type-dependent expressions in
+ order to expose bugs in *_dependent_expression_p and constexpr. */
+ if (cxx_dialect >= cxx0x)
+ maybe_constant_value (fold_non_dependent_expr (expr));
+#endif
+
/* Preserve OVERLOADs; the functions must be available to resolve
types. */
inner_expr = expr;
break;
case FUNCTION_DECL:
+ case TEMPLATE_DECL:
case LABEL_DECL:
return t;