aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 0a0b3ec..8a264d7 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -215,6 +215,19 @@ lvalue_p (tree ref)
(lvalue_p_1 (ref, /*class rvalue ok*/ 1) != clk_none);
}
+/* Test whether DECL is a builtin that may appear in a
+ constant-expression. */
+
+bool
+builtin_valid_in_constant_expr_p (tree decl)
+{
+ /* At present BUILT_IN_CONSTANT_P is the only builtin we're allowing
+ in constant-expressions. We may want to add other builtins later. */
+ return TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (decl) == BUILT_IN_CONSTANT_P;
+}
+
/* Build a TARGET_EXPR, initializing the DECL with the VALUE. */
static tree