summaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-21 17:38:02 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-21 17:38:02 +0000
commitbff898fbbe4358a4b7e337852df4d6043e0bd3f5 (patch)
tree95871ccf683cdcd1cc68588d8d01c44cb12a7588 /gcc/cp/pt.c
parent0268f1d4a4209be578170fa2c61557a15f4e3986 (diff)
downloadgcc-bff898fbbe4358a4b7e337852df4d6043e0bd3f5.tar.gz
PR c++/46977
* semantics.c (potential_constant_expression_1): Split out from potential_constant_expression. Add want_rval parm. Handle template expression forms. Don't enforce restriction on address of automatic variable here. Add a couple of diagnostics that had been missing. (require_potential_constant_expression): New entry point. (build_data_member_initialization, register_constexpr_fundef): Adjust. (maybe_constant_value): Check potential_constant_expression. * pt.c (fold_non_dependent_expr_sfinae): Likewise. * tree.c (build_vec_init_expr): Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169096 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 01f8cd772fb..7d39e1cb486 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5159,6 +5159,7 @@ fold_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
as two declarations of the same function, for example. */
if (processing_template_decl
&& !type_dependent_expression_p (expr)
+ && potential_constant_expression (expr)
&& !value_dependent_expression_p (expr))
{
HOST_WIDE_INT saved_processing_template_decl;
@@ -17964,11 +17965,11 @@ dependent_scope_p (tree scope)
[temp.dep.constexpr]. EXPRESSION is already known to be a constant
expression. */
-/* FIXME this predicate is not appropriate for general expressions; the
- predicates we want instead are "valid constant expression, value
- dependent or not?", "really constant expression, not value dependent?"
- and "instantiation-dependent?". Try to integrate with
- potential_constant_expression?
+/* Note that this predicate is not appropriate for general expressions;
+ only constant expressions (that satisfy potential_constant_expression)
+ can be tested for value dependence.
+
+ We should really also have a predicate for "instantiation-dependent".
fold_non_dependent_expr: fold if constant and not type-dependent and not value-dependent.
(what about instantiation-dependent constant-expressions?)