aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-12-17 15:41:07 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-12-17 15:41:07 -0500
commit13f649f66cbd81ef7c508e6b6e2740ba7eb566c0 (patch)
tree90f79ff4ea180de659e55d8bc70c1171bae7a95e /gcc/cp
parent43a39cdd9649098ad4bb3ede4333f64539f4e542 (diff)
downloadgcc-13f649f66cbd81ef7c508e6b6e2740ba7eb566c0.zip
gcc-13f649f66cbd81ef7c508e6b6e2740ba7eb566c0.tar.gz
gcc-13f649f66cbd81ef7c508e6b6e2740ba7eb566c0.tar.bz2
* constexpr.c: Tweak comments and formatting.
From-SVN: r218830
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/constexpr.c20
2 files changed, 17 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 42c0bb5..7c52b99 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-17 Jason Merrill <jason@redhat.com>
+
+ * constexpr.c: Tweak comments and formatting.
+
2014-12-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58650
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 732a79c..1323111 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1,6 +1,5 @@
-/* Perform the semantic phase of constexpr parsing, i.e., the process of
- building tree structure, checking semantic consistency, and
- building RTL. These routines are used both during actual parsing
+/* Perform -*- C++ -*- constant expression evaluation, including calls to
+ constexpr functions. These routines are used both during actual parsing
and during the instantiation of template functions.
Copyright (C) 1998-2014 Free Software Foundation, Inc.
@@ -866,11 +865,20 @@ struct constexpr_call_hasher : ggc_hasher<constexpr_call *>
is a map of values of variables initialized within the expression. */
struct constexpr_ctx {
+ /* The innermost call we're evaluating. */
constexpr_call *call;
+ /* Values for any temporaries or local variables within the
+ constant-expression. */
hash_map<tree,tree> *values;
+ /* The CONSTRUCTOR we're currently building up for an aggregate
+ initializer. */
tree ctor;
+ /* The object we're building the CONSTRUCTOR for. */
tree object;
+ /* Whether we should error on a non-constant expression or fail quietly. */
bool quiet;
+ /* Whether we are strictly conforming to constant expression rules or
+ trying harder to get a constant value. */
bool strict;
};
@@ -3428,9 +3436,8 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
{
bool non_constant_p = false;
bool overflow_p = false;
- constexpr_ctx ctx = { NULL, NULL, NULL, NULL, allow_non_constant, strict };
hash_map<tree,tree> map;
- ctx.values = &map;
+ constexpr_ctx ctx = { NULL, &map, NULL, NULL, allow_non_constant, strict };
tree type = initialized_type (t);
tree r = t;
if (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type))
@@ -3537,9 +3544,8 @@ is_sub_constant_expr (tree t)
{
bool non_constant_p = false;
bool overflow_p = false;
- constexpr_ctx ctx = { NULL, NULL, NULL, NULL, true, true };
hash_map <tree, tree> map;
- ctx.values = &map;
+ constexpr_ctx ctx = { NULL, &map, NULL, NULL, true, true };
cxx_eval_constant_expression (&ctx, t, false, &non_constant_p,
&overflow_p);
return !non_constant_p && !overflow_p;