diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-10-07 21:37:46 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-10-07 21:37:46 +0200 |
commit | be845b04a8e13e91e7ecd76b60254c7d0acfda2e (patch) | |
tree | 7b14e19adcc90c0ed591c2745b010b6ffcf52ade /gcc/cp/constexpr.c | |
parent | 082139830afb428628657a7520659a01ae00b852 (diff) | |
download | gcc-be845b04a8e13e91e7ecd76b60254c7d0acfda2e.zip gcc-be845b04a8e13e91e7ecd76b60254c7d0acfda2e.tar.gz gcc-be845b04a8e13e91e7ecd76b60254c7d0acfda2e.tar.bz2 |
Implement LWG2296 helper intrinsic c-family/
Implement LWG2296 helper intrinsic
c-family/
* c-common.h (enum rid): Add RID_ADDRESSOF.
* c-common.c (c_common_reswords): Add __builtin_addressof.
cp/
* parser.c (cp_parser_postfix_expression): Handle RID_ADDRESSOF.
* cp-objcp-common.c (cp_common_init_ts): Handle ADDRESSOF_EXPR.
* constexpr.c (potential_constant_expression_1): Likewise.
* error.c (dump_expr): Likewise.
* typeck.c (cp_build_addressof): New function.
* cp-tree.h (cp_build_addressof): Declare.
* cxx-pretty-print.h (pp_cxx_addressof_expression): Declare.
* cp-tree.def (ADDRESSOF_EXPR): New tree code.
* cxx-pretty-print.c (cxx_pretty_printer::primary_expression): Handle
ADDRESSOF_EXPR. Add __builtin_addressof and
__has_unique_object_representations into syntax in function comment.
(pp_cxx_addressof_expression): New function.
* pt.c (tsubst_copy_and_build): Handle ADDRESSOF_EXPR.
testsuite/
* g++.dg/cpp0x/addressof1.C: New test.
* g++.dg/cpp0x/addressof2.C: New test.
From-SVN: r240873
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r-- | gcc/cp/constexpr.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 4acbb26..f5235fc 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -5025,6 +5025,11 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, return (RECUR (from, TREE_CODE (t) != VIEW_CONVERT_EXPR)); } + case ADDRESSOF_EXPR: + /* This is like ADDR_EXPR, except it won't form pointer-to-member. */ + t = TREE_OPERAND (t, 0); + goto handle_addr_expr; + case ADDR_EXPR: /* -- a unary operator & that is applied to an lvalue that designates an object with thread or automatic storage @@ -5035,6 +5040,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, /* A pointer-to-member constant. */ return true; + handle_addr_expr: #if 0 /* FIXME adjust when issue 1197 is fully resolved. For now don't do any checking here, as we might dereference the pointer later. If |