c++ modules: ICE with bitfield in class template
commitf7f4628054358a92a55d52645cf107aa26ff6765
authorPatrick Palka <ppalka@redhat.com>
Fri, 7 Oct 2022 16:01:58 +0000 (7 12:01 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 7 Oct 2022 16:01:58 +0000 (7 12:01 -0400)
tree156cf9103fca664022bdde817e6c4a2b7ec39da1
parentf8ba88b6a811ca9bb4b8411d3f65c329fb480ee1
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.
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/bfield-3.H [new file with mode: 0644]