if (TREE_CODE (t) != TYPE_DECL)
fld_worklist_push (DECL_INITIAL (t), fld);
+ /* Remove C++ annotations, those aren't needed for LTO and contain
+ trees we sometimes can't stream. */
+ DECL_ATTRIBUTES (t)
+ = remove_attribute ("annotation ", DECL_ATTRIBUTES (t));
fld_worklist_push (DECL_ATTRIBUTES (t), fld);
fld_worklist_push (DECL_ABSTRACT_ORIGIN (t), fld);
fld_worklist_push (TYPE_CACHED_VALUES (t), fld);
fld_worklist_push (TYPE_SIZE (t), fld);
fld_worklist_push (TYPE_SIZE_UNIT (t), fld);
+ /* Remove C++ annotations, those aren't needed for LTO and contain
+ trees we sometimes can't stream. */
+ TYPE_ATTRIBUTES (t)
+ = remove_attribute ("annotation ", TYPE_ATTRIBUTES (t));
fld_worklist_push (TYPE_ATTRIBUTES (t), fld);
fld_worklist_push (TYPE_POINTER_TO (t), fld);
fld_worklist_push (TYPE_REFERENCE_TO (t), fld);
--- /dev/null
+// PR c++/123837
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+// { dg-additional-options "-flto" { target lto } }
+
+struct A {};
+[[=A {}]] int a {};
+struct [[=A {}]] B { int b; };
+B b {};
+
+int
+main ()
+{
+}