aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-11 17:29:56 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-11 17:29:56 -0400
commitefd115c1c6e42f689659802e4eab60c455a53579 (patch)
treeb3c63a06ee4bcc704d80155363cce33f3988113b
parentf5ad54d7786c2cfa42d9e3afe1fdff209aea023d (diff)
downloadgcc-efd115c1c6e42f689659802e4eab60c455a53579.zip
gcc-efd115c1c6e42f689659802e4eab60c455a53579.tar.gz
gcc-efd115c1c6e42f689659802e4eab60c455a53579.tar.bz2
* decl.c (grokdeclarator): Only set DECL_DECLARED_CONSTEXPR_P once.
From-SVN: r173680
-rw-r--r--gcc/cp/ChangeLog2
-rw-r--r--gcc/cp/decl.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 746b69d..d6241cd 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,7 @@
2011-05-11 Jason Merrill <jason@redhat.com>
+ * decl.c (grokdeclarator): Only set DECL_DECLARED_CONSTEXPR_P once.
+
* 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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index eff2360..ad816f1 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9933,7 +9933,6 @@ grokdeclarator (const cp_declarator *declarator,
return error_mark_node;
}
- DECL_DECLARED_CONSTEXPR_P (decl) = constexpr_p;
decl = do_friend (ctype, unqualified_id, decl,
*attrlist, flags,
funcdef_flag);
@@ -10183,8 +10182,11 @@ grokdeclarator (const cp_declarator *declarator,
}
}
else if (constexpr_p && DECL_EXTERNAL (decl))
- error ("declaration of constexpr variable %qD is not a definition",
- decl);
+ {
+ error ("declaration of constexpr variable %qD is not a definition",
+ decl);
+ constexpr_p = false;
+ }
}
if (storage_class == sc_extern && initialized && !funcdef_flag)
@@ -10213,8 +10215,8 @@ grokdeclarator (const cp_declarator *declarator,
else if (storage_class == sc_static)
DECL_THIS_STATIC (decl) = 1;
- /* Don't forget constexprness. */
- if (constexpr_p)
+ /* Set constexpr flag on vars (functions got it in grokfndecl). */
+ if (constexpr_p && TREE_CODE (decl) == VAR_DECL)
DECL_DECLARED_CONSTEXPR_P (decl) = true;
/* Record constancy and volatility on the DECL itself . There's