[cfe-dev] Template specialization: why drop attributes?
Richard Smith
richard at metafoo.co.uk
Fri Jun 15 14:20:07 PDT 2012
Hi,
On Fri, Jun 15, 2012 at 1:38 PM, Sharlet, Dillon
<dillon.sharlet at intel.com> wrote:
> What you said makes sense. However, maybe there is a separate issue, because I don't think the function has already been implicitly instantiated. I see the issue I described with the following program:
>
>
> template < int N >
> int Test(int x) __attribute__((custom))
> {
> return x * N;
> }
>
> template < >
> int Test < 1 > (int x) __attribute__((custom))
When we see this declaration, we implicitly instantiate the base
template in order to check that the explicit specialization matches
it. So we implicitly instantiate a declaration:
int Test<1>(int) __attribute__((custom));
It's that declaration from which we should be stripping the
attributes. If this is also stripping attributes which were specified
on the explicit specialization, I believe that is simply a bug.
More information about the cfe-dev
mailing list