aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-11 17:29:49 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-11 17:29:49 -0400
commitf5ad54d7786c2cfa42d9e3afe1fdff209aea023d (patch)
tree1e2d01a6e37dc49c0266ecd7f0b0e873cd01cf20 /gcc
parent3e475d30a363db90039aec1239fcfc1a15e202aa (diff)
downloadgcc-f5ad54d7786c2cfa42d9e3afe1fdff209aea023d.zip
gcc-f5ad54d7786c2cfa42d9e3afe1fdff209aea023d.tar.gz
gcc-f5ad54d7786c2cfa42d9e3afe1fdff209aea023d.tar.bz2
pt.c (build_non_dependent_expr): Don't check null_ptr_cst_p, do call maybe_constant_value in C++0x mode.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c11
-rw-r--r--gcc/cp/semantics.c1
3 files changed, 12 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fe1ccb5..746b69d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 74d4cbf..4b32ce9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18871,10 +18871,13 @@ build_non_dependent_expr (tree expr)
{
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;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 0ba0370..bfe233e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -6911,6 +6911,7 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
break;
case FUNCTION_DECL:
+ case TEMPLATE_DECL:
case LABEL_DECL:
return t;