On 2016-08-23 15:07, Richard Smith wrote:
Okay, I think I follow that. Essentially, what you are saying is that in
the "ivory tower" world of the standard by itself (wherein, IIRC,
concepts like "linking" and "translation units" don't exist), there is
no reason why an explicit instantiation would ever have attributes?
That makes sense, but unfortunately doesn't line up very well with real
world practice.
Practically speaking, an explicit instantiation provides a definition
that can be used to satisfy the linker when another TU needs the
template but does not have a definition available to instantiate (or has
been instructed to suppress instantiation). In that world, at least ELF
visibility attributes are... well, somewhat important :-). And
therefore, the blanket prohibition on attributes is... unfortunate.
(By the same token, it's also unfortunate that the obvious use case for
attributes on explicit instantiations "doesn't exist" in the limited
world view of the standard :-). Alas, I think this is one place where
the real world should probably be allowed to intrude.)
I'd like to propose to remove this restriction (see thread on
std-proposals). At least, I am assuming this is a change for which a DR
would not be appropriate?
(I note for the record that, based on your comment in
https://llvm.org/bugs/show_bug.cgi?id=29094, I suspect we agree, but are
repeating this conversation for the sake of the std-discussion audience.
Also, thanks for the discussion!)
--
Matthew