https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99871
Bug ID: 99871 Summary: #includes inside push visibility scope Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: nathan at gcc dot gnu.org Target Milestone: --- I ran into this working on module bugs (99823). While it is not affecting that debugging, it has code smell. We have the following: #pragma GCC visibility push(default) .. some decls #include <other header> ... more decls #pragma GCC visibility pop The case I ran into is # 33 "../x86_64-pc-linux-gnu/libstdc++-v3/include/bits/nested_exception.h" 3 #pragma GCC visibility push(default) ... #include "type_traits" ... #pragma GCC visibility pop That visibility pragma will not affect the visibility of decls in type_traits, when that is translated to an include. Fortunately, you asked for default visibility.