diff options
author | Jason Merrill <jason@redhat.com> | 2016-11-15 00:22:28 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-11-15 00:22:28 -0500 |
commit | 47e5d7ccf12c5d11abdd18e8e9089735e4fd3d05 (patch) | |
tree | 376f8789de74bf75a940c9583acaea031e9de6d6 /gcc/cp/semantics.c | |
parent | a274cc11ac675686a71aef82e2e734795d18f339 (diff) | |
download | gcc-47e5d7ccf12c5d11abdd18e8e9089735e4fd3d05.zip gcc-47e5d7ccf12c5d11abdd18e8e9089735e4fd3d05.tar.gz gcc-47e5d7ccf12c5d11abdd18e8e9089735e4fd3d05.tar.bz2 |
Various C++17 decomposition fixes.
* tree.c (bitfield_p): New.
* cp-tree.h: Declare it.
* typeck.c (cxx_sizeof_expr, cxx_alignof_expr)
(cp_build_addr_expr_1): Use it instead of DECL_C_BIT_FIELD.
* decl.c (cp_finish_decomp): Look through reference. Always
SET_DECL_DECOMPOSITION_P.
* semantics.c (finish_decltype_type): Adjust decomposition handling.
From-SVN: r242408
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0164f2e..29f5233 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -8873,8 +8873,13 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, if (identifier_p (expr)) expr = lookup_name (expr); - if (VAR_P (expr) && DECL_HAS_VALUE_EXPR_P (expr)) - expr = DECL_VALUE_EXPR (expr); + /* The decltype rules for decomposition are different from the rules for + member access; in particular, the decomposition decl gets + cv-qualifiers from the aggregate object, whereas decltype of a member + access expr ignores the object. */ + if (VAR_P (expr) && DECL_DECOMPOSITION_P (expr) + && DECL_HAS_VALUE_EXPR_P (expr)) + return unlowered_expr_type (DECL_VALUE_EXPR (expr)); if (INDIRECT_REF_P (expr)) /* This can happen when the expression is, e.g., "a.b". Just |