On Tue, Feb 14, 2017 at 3:13 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> The following testcase fails, because while we have the nodiscard
> attribute on the template, we actually never propagate it to the
> instantiation, which is where it is checked (I'm really surprised about
> this).

Normally we propagate attributes when instantiating the class; see the
call to apply_late_template_attributes in
instantiate_class_template_1.  I'm not sure why that wouldn't be
happening here; are we calling maybe_warn_nodiscard before
instantiating the class?

> Unfortunately, this patch regresses
> FAIL: g++.dg/ext/visibility/template8.C  -std=gnu++{11,14,98}  scan-hidden 
> hidden[ \\t_]*_Z1gI1AI1BEEvT_
> It expects that the visibility attribute from the template never
> makes it to the implementation or something, is that correct?  Or do
> we need to handle visibility in some special way?

Visibility is handled specially; determine_visibility looks up the
visibility of the template if the specialization doesn't specify its
own visibility.

> Regarding the first hunk, it is just a wild guess, I couldn't trigger
> that code by make check-c++-all.  Is there a way to get it through
> some partial instantiation of scoped enum with/without attributes or
> something similar?

Hmm, not sure.

> Anyway, except for that template8.C the patch passed bootstrap/regtest
> on x86_64-linux and i686-linux.  But it really puzzles me that the
> attributes aren't instantiated, what happens e.g. with abi_tag
> attribute?

abi_tag and may_alias are applied specifically in lookup_class_template_1.

Jason

Reply via email to