https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71154
--- Comment #3 from James Abbatiello <abbeyj+gcc at gmail dot com> --- Andrew Pinsky, I'm not sure I understand your comment. Why would the visibility of D be affected by the visibility of C<int>? If I change your test case so that C<int> is declared as hidden before the definition of D then I get this warning: warning: āDā declared with greater visibility than the type of its field āD::aā [-Wattributes] But it is just a warning and it does not cause D to have hidden visibility. Did you have some different test in mind? I've also tried your testcase with clang++ and it acts as I would expect (D is visible, C<int> is hidden). So it seems that it is possible to support this behavior even if it might be difficult within g++ for some reason. Can you please unresolve this bug? Limit it just the visibility attribute if you need to but I still want this change.