Jason Merrill <[EMAIL PROTECTED]> writes: > Benjamin Smedberg wrote: > > Jason Merrill wrote: > > > >> Do you agree with implicitly giving template instantiations the > >> minimum visibility of the template and arguments unless explicitly > >> overridden? > > This is not what I would naturally expect, coming from a > > dllimport/export mindset, but I don't think it's a problem from the > > mozilla POV: all of our exports are explicitly declared if/when we > > use hidden visibility pragmas. > > Is a pragma considered an explicit override? e.g. > > class nsIAbstract { > > virtual void Bar(); > > }; > > #pragma GCC visibility push(default) > > nsIAbstract* Getter(); > > #pragma GCC visibility pop > > For a namespace-scope entity like this, yes (class members and > template instantiations use the visibility of their class and template > in preference to the current #pragma). > > >> Also, do you agree with warning about a class with greater > >> visibility than its data members/bases? > > Sure... I would really like to disable this warning if possible, > > since it will be produced thousands of times in a mozilla build ;-) > > I find that surprising, since it sounds like VC++ gives the same > warning about a dllexport class with a non-dllexport base.
I think that if the aim is to have VC++ compatibility, that should be separate from the 'right' solution. Apple has a flag, -fvisibility-ms-compat, which attempts to achieve this, and which we'll probably contribute for 4.3. There are some things that this flag does which you definitely wouldn't want in well-structured code and other things which the flag does which may limit the C++ features you'll be able to use in future (like serialisation if that ever gets standardized).