c++: ICE with attribute on enumerator [PR104667]
commitc8b0571e334792c0c789438617cfb7faf86ab599
authorMarek Polacek <polacek@redhat.com>
Thu, 24 Feb 2022 21:41:53 +0000 (24 16:41 -0500)
committerMarek Polacek <polacek@redhat.com>
Mon, 28 Feb 2022 16:29:25 +0000 (28 11:29 -0500)
tree2595d312e4e2c34215135798b5e1d2e43fc37cf9
parent3f3246eb16f554c70c5ce87ad2c785f83adb4625
c++: ICE with attribute on enumerator [PR104667]

When processing a template, the enumerators we build don't have a type
yet.  But is_late_template_attribute is not prepared to see a _DECL
without a type, so we crash on

  enum tree_code code = TREE_CODE (type);

(I found that we don't give the "is deprecated" warning for the enumerator
'f' in the test.  Reported as PR104682.)

PR c++/104667

gcc/cp/ChangeLog:

* decl2.cc (is_late_template_attribute): Cope with a decl without
a type.

gcc/testsuite/ChangeLog:

* g++.dg/ext/attrib64.C: New test.
gcc/cp/decl2.cc
gcc/testsuite/g++.dg/ext/attrib64.C [new file with mode: 0644]