[cfe-commits] [Patch] Forbid C++11 attributes on explicit template instantiation.

Michael Han fragmentshaders at gmail.com
Tue Dec 11 21:39:02 PST 2012

Thanks for the info. Do you happen to know why C++11 has this rule?

I got into this as I noted the same was implemented in gcc 4.8 [1] while
working on attributes. There are several options:
- Forbid C++11 attributes on explicit template instantiations and treat
such program as ill formed.
- Issue a warning and ignore the attributes. This seems what gcc is doing.
- Issue a warning but not ignore the attributes. This allows existing
visibility attributes migrate to new syntax with same semantics.

Which is the right direction to go here?



On Tue, Dec 11, 2012 at 8:01 PM, John McCall <rjmccall at apple.com> wrote:

> On Dec 7, 2012, at 3:08 PM, Michael Han <fragmentshaders at gmail.com> wrote:
> > This small patch forbids C++11 attributes on explicit template
> instantiations, as required by C++11 [dcl.attr.grammar] p4.
> Hmm.  It's easy to imagine attributes that are useful on explicit template
> instantiations.  We already support visibility attributes here (to override
> the visibility of the instantiated symbols), and we've discussed having an
> attribute which would guarantee a unique explicit instantiation (allowing
> the symbols to be emitted with strong linkage).  So this is a rather
> unfortunate language rule, and it undermines any argument that people ought
> to prefer the new syntax for existing attributes.
> John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121211/2f710e44/attachment.html>

More information about the cfe-commits mailing list