aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-tree.h
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-06-05 16:33:43 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2005-06-05 16:33:43 +0000
commit88a7beb769bd14c1affeb7c801842058e3071ab6 (patch)
tree09ed262a183deef78ec843c1e53a4e09cbc6dda4 /gcc/cp/cp-tree.h
parent1d508aa99c31e13d6712873d5be5ef04a902807d (diff)
downloadgcc-88a7beb769bd14c1affeb7c801842058e3071ab6.zip
gcc-88a7beb769bd14c1affeb7c801842058e3071ab6.tar.gz
gcc-88a7beb769bd14c1affeb7c801842058e3071ab6.tar.bz2
re PR c++/21619 (__builtin_constant_p(&"Hello"[0])?1:-1 not compile-time constant)
PR c++/21619 * cp-tree.h (DECL_IS_BUILTIN_CONSTANT_P): New macro. * parser.c (cp_parser_postfix_expression): Allow non-constant expressions as arguments to __builtin_constant_p. * tree.c (builtin_valid_in_constant_expr_p): Use DECL_IS_BUILTIN_CONSTANT_P. PR c++/21619 * g++.dg/ext/builtin9.C: New test. From-SVN: r100626
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r--gcc/cp/cp-tree.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0f3dfa5..bcc6b3f 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1787,6 +1787,12 @@ struct lang_decl GTY(())
#define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
(DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p)
+/* Nonzero if DECL is a declaration of __builtin_constant_p. */
+#define DECL_IS_BUILTIN_CONSTANT_P(NODE) \
+ (TREE_CODE (NODE) == FUNCTION_DECL \
+ && DECL_BUILT_IN_CLASS (NODE) == BUILT_IN_NORMAL \
+ && DECL_FUNCTION_CODE (NODE) == BUILT_IN_CONSTANT_P)
+
/* Nonzero for _DECL means that this decl appears in (or will appear
in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
detecting circularity in case members are multiply defined. In the