aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/constexpr.cc')
-rw-r--r--gcc/cp/constexpr.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 2038f43..0366396 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -2088,7 +2088,7 @@ cxx_dynamic_cast_fn_p (tree fndecl)
{
return (cxx_dialect >= cxx20
&& id_equal (DECL_NAME (fndecl), "__dynamic_cast")
- && CP_DECL_CONTEXT (fndecl) == global_namespace);
+ && CP_DECL_CONTEXT (fndecl) == abi_node);
}
/* Often, we have an expression in the form of address + offset, e.g.
@@ -7598,6 +7598,19 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
}
break;
+ case EXCESS_PRECISION_EXPR:
+ {
+ tree oldop = TREE_OPERAND (t, 0);
+
+ tree op = cxx_eval_constant_expression (ctx, oldop,
+ lval,
+ non_constant_p, overflow_p);
+ if (*non_constant_p)
+ return t;
+ r = fold_convert (TREE_TYPE (t), op);
+ break;
+ }
+
case EMPTY_CLASS_EXPR:
/* Handle EMPTY_CLASS_EXPR produced by build_call_a by lowering
it to an appropriate CONSTRUCTOR. */
@@ -8898,6 +8911,9 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
sub-object of such an object; */
return RECUR (TREE_OPERAND (t, 0), rval);
+ case EXCESS_PRECISION_EXPR:
+ return RECUR (TREE_OPERAND (t, 0), rval);
+
case VAR_DECL:
if (DECL_HAS_VALUE_EXPR_P (t))
{