summaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-29 17:53:50 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-29 17:53:50 +0000
commit811c4f15ae872df6c455c4c7d17d3b17f7daa81c (patch)
treefcd62b99968f8938843ab7d38f586f9001aece90 /gcc/cp/class.c
parent52f26f82114c4bc4376627d341f61d855ec6ea0f (diff)
downloadgcc-811c4f15ae872df6c455c4c7d17d3b17f7daa81c.tar.gz
P0683R1 - default member initializers for bit-fields
cp/ * cp-tree.h (grokbitfield): Add INIT parameter. * parser.c (cp_parser_constant_expression): Add STRICT_P argument, if true, parse a conditional-expression rather than assignment-expression. (cp_parser_member_declaration): For C++11 and later pass true as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for DECL_C_BIT_FIELDs. (cp_parser_objc_class_ivars): Adjust grokbitfield caller. * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs. (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs. * decl2.c (grokbitfield): Add INIT parameter, pass it to cp_finish_decl. * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not just non-bitfields. testsuite/ * g++.dg/ext/bitfield6.C: New test. * g++.dg/cpp2a/bitfield1.C: New test. * g++.dg/cpp2a/bitfield2.C: New test. * g++.dg/cpp2a/bitfield3.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253302 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 687ddaa5c8f..0c4a7b3db04 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3324,7 +3324,7 @@ check_field_decl (tree field,
{
for (tree fields = TYPE_FIELDS (type); fields;
fields = DECL_CHAIN (fields))
- if (TREE_CODE (fields) == FIELD_DECL && !DECL_C_BIT_FIELD (field))
+ if (TREE_CODE (fields) == FIELD_DECL)
any_default_members |= check_field_decl (fields, t,
cant_have_const_ctor,
no_const_asn_ref);
@@ -3636,10 +3636,10 @@ check_field_decls (tree t, tree *access_decls,
/* We set DECL_C_BIT_FIELD in grokbitfield.
If the type and width are valid, we'll also set DECL_BIT_FIELD. */
- if ((! DECL_C_BIT_FIELD (x) || ! check_bitfield_decl (x))
- && check_field_decl (x, t,
- cant_have_const_ctor_p,
- no_const_asn_ref_p))
+ if (DECL_C_BIT_FIELD (x))
+ check_bitfield_decl (x);
+
+ if (check_field_decl (x, t, cant_have_const_ctor_p, no_const_asn_ref_p))
{
if (any_default_members
&& TREE_CODE (t) == UNION_TYPE)