https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106977
--- Comment #10 from ibuclaw at gcc dot gnu.org --- Without using `->visible()` would be something like: --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -2559,10 +2561,17 @@ set_linkage_for_decl (tree decl) void set_visibility_for_decl (tree node, Dsymbol *sym) { - Visibility visibility = sym->visible (); - if (visibility.kind == Visibility::private_) + Visibility::Kind kind; + if (AggregateDeclaration *ad = sym->isAggregateDeclaration ()) + kind = ad->visibility.kind; + else if (Declaration *d = sym->isDeclaration ()) + kind = d->visibility.kind; + else + gcc_unreachable (); + + if (kind == Visibility::private_) TREE_PRIVATE (node) = 1; - else if (visibility.kind == Visibility::protected_) + else if (kind == Visibility::protected_) TREE_PROTECTED (node) = 1; /* If the declaration was declared `export', append either the dllimport