Matthew Woehlke
unread,Aug 24, 2016, 1:37:52 PM8/24/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to std-pr...@isocpp.org
Consider the following code which exports an explicit instantiation of a
template (e.g. imagine this is in a .cpp file of a library):
template <typename T> T foo(T*)
{
// ...
}
template FOO_EXPORT int foo<int>(int*);
Modern C++ allows FOO_EXPORT on ELF platforms using GCC and Clang to be
defined as `[[gnu::visibility("default")]]`... right?
Alas, no. Attributes on explicit instantiations are explicitly forbidden
([dcl.attr.grammar]/5). (Despite that, GCC is happy to DTRT here. Clang,
however, enforces the standard, even though this particular prohibition
- especially for the attribute in this example - seems to be of
questionable value.)
This is obviously unfortunate. Is there any reason for this restriction
to be in place? If not, I propose to remove it.
--
Matthew