diff options
author | Jason Merrill <jason@redhat.com> | 2011-07-11 14:52:19 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-07-11 14:52:19 -0400 |
commit | 5fb8060d5b57061e6b683aebdd04a915473963f6 (patch) | |
tree | 7ad116e226f3d40de05a19d56a560290ce395cdb /gcc/cp/decl2.c | |
parent | 4904b64bf7dc5538b06d2ba01fc1c55231c09bb8 (diff) | |
download | gcc-5fb8060d5b57061e6b683aebdd04a915473963f6.zip gcc-5fb8060d5b57061e6b683aebdd04a915473963f6.tar.gz gcc-5fb8060d5b57061e6b683aebdd04a915473963f6.tar.bz2 |
* decl2.c (decl_constant_var_p): Use decl_maybe_constant_var_p.
From-SVN: r176177
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index d90d4b5..e1f9562 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3574,26 +3574,16 @@ decl_defined_p (tree decl) bool decl_constant_var_p (tree decl) { - bool ret; - tree type = TREE_TYPE (decl); - if (TREE_CODE (decl) != VAR_DECL) + if (!decl_maybe_constant_var_p (decl)) return false; - if (DECL_DECLARED_CONSTEXPR_P (decl) - || (CP_TYPE_CONST_NON_VOLATILE_P (type) - && INTEGRAL_OR_ENUMERATION_TYPE_P (type))) - { - /* We don't know if a template static data member is initialized with - a constant expression until we instantiate its initializer. Even - in the case of a constexpr variable, we can't treat it as a - constant until its initializer is complete in case it's used in - its own initializer. */ - mark_used (decl); - ret = DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl); - } - else - ret = false; - return ret; + /* We don't know if a template static data member is initialized with + a constant expression until we instantiate its initializer. Even + in the case of a constexpr variable, we can't treat it as a + constant until its initializer is complete in case it's used in + its own initializer. */ + mark_used (decl); + return DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl); } /* Returns true if DECL could be a symbolic constant variable, depending on |