diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-12-03 09:21:29 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-12-03 09:21:29 +0100 |
commit | 6fcb7ebb377f27c7f38780f95998ad7a148b7f5b (patch) | |
tree | a93883c53d737926c1a5f4b5d775d7adf5d3feed /gcc/cp/typeck2.c | |
parent | e0daa2c86b74364a8ae13fc8e3f4a06c48139719 (diff) | |
download | gcc-6fcb7ebb377f27c7f38780f95998ad7a148b7f5b.zip gcc-6fcb7ebb377f27c7f38780f95998ad7a148b7f5b.tar.gz gcc-6fcb7ebb377f27c7f38780f95998ad7a148b7f5b.tar.bz2 |
re PR c++/92732 (Bit-field of scoped enumeration type cannot be initialized)
PR c++/92732
* typeck2.c (digest_nsdmi_init): For bitfields, use
DECL_BIT_FIELD_TYPE instead of TREE_TYPE.
* g++.dg/cpp2a/bitfield3.C: Don't expect narrowing conversion
warnings.
* g++.dg/cpp2a/bitfield4.C: New test.
From-SVN: r278923
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r-- | gcc/cp/typeck2.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index b886854..ae00de2 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1335,6 +1335,8 @@ digest_nsdmi_init (tree decl, tree init, tsubst_flags_t complain) gcc_assert (TREE_CODE (decl) == FIELD_DECL); tree type = TREE_TYPE (decl); + if (DECL_BIT_FIELD_TYPE (decl)) + type = DECL_BIT_FIELD_TYPE (decl); int flags = LOOKUP_IMPLICIT; if (DIRECT_LIST_INIT_P (init)) { |