Commit efd115c1 by Jason Merrill Committed by Jason Merrill

* decl.c (grokdeclarator): Only set DECL_DECLARED_CONSTEXPR_P once.

From-SVN: r173680
parent f5ad54d7
2011-05-11 Jason Merrill <jason@redhat.com> 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, * pt.c (build_non_dependent_expr): Don't check null_ptr_cst_p,
do call maybe_constant_value in C++0x mode. do call maybe_constant_value in C++0x mode.
* semantics.c (cxx_eval_constant_expression): Handle TEMPLATE_DECL. * semantics.c (cxx_eval_constant_expression): Handle TEMPLATE_DECL.
......
...@@ -9933,7 +9933,6 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -9933,7 +9933,6 @@ grokdeclarator (const cp_declarator *declarator,
return error_mark_node; return error_mark_node;
} }
DECL_DECLARED_CONSTEXPR_P (decl) = constexpr_p;
decl = do_friend (ctype, unqualified_id, decl, decl = do_friend (ctype, unqualified_id, decl,
*attrlist, flags, *attrlist, flags,
funcdef_flag); funcdef_flag);
...@@ -10183,8 +10182,11 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10183,8 +10182,11 @@ grokdeclarator (const cp_declarator *declarator,
} }
} }
else if (constexpr_p && DECL_EXTERNAL (decl)) else if (constexpr_p && DECL_EXTERNAL (decl))
{
error ("declaration of constexpr variable %qD is not a definition", error ("declaration of constexpr variable %qD is not a definition",
decl); decl);
constexpr_p = false;
}
} }
if (storage_class == sc_extern && initialized && !funcdef_flag) if (storage_class == sc_extern && initialized && !funcdef_flag)
...@@ -10213,8 +10215,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10213,8 +10215,8 @@ grokdeclarator (const cp_declarator *declarator,
else if (storage_class == sc_static) else if (storage_class == sc_static)
DECL_THIS_STATIC (decl) = 1; DECL_THIS_STATIC (decl) = 1;
/* Don't forget constexprness. */ /* Set constexpr flag on vars (functions got it in grokfndecl). */
if (constexpr_p) if (constexpr_p && TREE_CODE (decl) == VAR_DECL)
DECL_DECLARED_CONSTEXPR_P (decl) = true; DECL_DECLARED_CONSTEXPR_P (decl) = true;
/* Record constancy and volatility on the DECL itself . There's /* Record constancy and volatility on the DECL itself . There's
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment