clang, -fvisibility=hidden, static class method

I am seeing some unexpected (unwanted) behaviour from clang concerning
-fvisibility=hidden and static class method. When I build a shared
library with -fvisibility=hidden consisting of a function with a
static variable as expected the static variable is NOT exported.
However if I build the same library with -fvisibility=hidden but
modified so that the same function is now a static method method is a
method of a class, the static variable IS exported. I am NOT
decorating anything with :
__attribute__ ((visibility("default")))

To better illustrate I have pasted the code below

My dev environment has the following components:


There have been a lot of visibility fixes in the last year; please try again with a relatively recent clang.


- Hide quoted text -

I am still having this visiblity issue:

This is with clang from svn updated yesterday.

The only workaround I have been able to find is to not use -fvisibility=hidden for libraries which export template instantations — this workaround causes some linker warnings related to different visiblity of internal stdlib symbols which I think are wrong, becaue even if I ensure all headers are included with same visibility¹ the warnings persist, but given how I can’t use the visibility pragma to export the explicit templates, I have a feeling that this pragma isn’t 100% effective…

¹ Using #pragma GCC visibility push(…) / pop.