On Sun, Dec 20, 2015 at 01:34:51PM -0500, Jason Merrill wrote:
> commit 6804dee422ff9a85298a24ae0912e82ed0d7e988
> Author: Jason Merrill <ja...@redhat.com>
> Date:   Thu Dec 17 15:41:32 2015 -0500
> 
>       PR c++/67411
>     
>       * decl2.c (decl_maybe_constant_var_p): A proxy isn't constant.
> 
> diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
> index 5ae6266..1e4282a 100644
> --- a/gcc/cp/decl2.c
> +++ b/gcc/cp/decl2.c
> @@ -4222,6 +4222,9 @@ decl_maybe_constant_var_p (tree decl)
>      return false;
>    if (DECL_DECLARED_CONSTEXPR_P (decl))
>      return true;
> +  if (DECL_VALUE_EXPR (decl))
> +    /* A proxy isn't constant.  */
> +    return false;

Shouldn't this be DECL_HAS_VALUE_EXPR_P (decl) instead?
Or are you for proxies doing SET_DECL_VALUE_EXPR without setting
DECL_HAS_VALUE_EXPR_P bit?  DECL_HAS_VALUE_EXPR_P is very cheap,
while DECL_VALUE_EXPR is a hash table lookup.

>    return (CP_TYPE_CONST_NON_VOLATILE_P (type)
>         && INTEGRAL_OR_ENUMERATION_TYPE_P (type));
>  }

        Jakub

Reply via email to