diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-10-07 12:01:58 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-10-07 12:01:58 -0400 |
commit | f7f4628054358a92a55d52645cf107aa26ff6765 (patch) | |
tree | 156cf9103fca664022bdde817e6c4a2b7ec39da1 /gcc/testsuite | |
parent | f8ba88b6a811ca9bb4b8411d3f65c329fb480ee1 (diff) | |
download | gcc-f7f4628054358a92a55d52645cf107aa26ff6765.zip gcc-f7f4628054358a92a55d52645cf107aa26ff6765.tar.gz gcc-f7f4628054358a92a55d52645cf107aa26ff6765.tar.bz2 |
c++ modules: ICE with bitfield in class template
According to grokbitfield, DECL_BIT_FIELD_REPRESENTATIVE contains the
width of the bitfield until we layout the class type (after which it'll
contain a decl). Thus for a bitfield in a class template it'll always
be the width, and this patch makes us avoid ICEing from mark_class_def
in this case.
gcc/cp/ChangeLog:
* module.cc (trees_out::mark_class_def): Guard against
DECL_BIT_FIELD_REPRESENTATIVE not being a decl.
gcc/testsuite/ChangeLog:
* g++.dg/modules/bfield-3.H: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/g++.dg/modules/bfield-3.H | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/modules/bfield-3.H b/gcc/testsuite/g++.dg/modules/bfield-3.H new file mode 100644 index 0000000..4fd4db7 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/bfield-3.H @@ -0,0 +1,8 @@ +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +template<int N> +struct A { + int x : 1; + int y : N; +}; |