<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 8, 2016 at 1:20 PM, Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 8 September 2016 at 21:07, Milian Wolff <<a href="mailto:mail@milianw.de">mail@milianw.de</a>> wrote:<br>
> I think this could be related:<br>
><br>
> <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71463" rel="noreferrer" target="_blank">https://gcc.gnu.org/bugzilla/<wbr>show_bug.cgi?id=71463</a><br>
<br>
</span>Hum, it does look like the same problem.<br></blockquote><div><br></div><div>I don't think so. The difference is, in that case, there is an attribute on the entity that's part of the sugared type and gets erased through the template argument. In this case, there is not.</div><div><br></div><div>I don't have GCC 6.1.1 so I can't put together a reduced testcase, but as far as I can see, it would be something like this:</div><div><br></div><div>struct alignas(8) S {};</div><div>template<typename T> struct id { typedef T type; };<br></div><div>template<typename T> struct X {};</div><div>X<id<const S*>::type> x;</div><div><br></div><div>Note that the error GCC gives is for the template argument to X, not the template argument to id, so somehow passing 'const S*' through a template parameter and a typedef has made GCC incorrectly decide that there's an attribute on the sugared type.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Eric, one of the comments was:<br>
<br>
"The attribute isn't properly part of the C++ type, so in the testcase<br>
below A<fna> needs to be the same type as A<fn>, and so they share a<br>
member function.  So we have to choose which type to use as the<br>
canonical type, and we choose the type without the attribute.  And<br>
that's what the "ignoring attributes" warning is telling you.<br>
<br>
typedef int fn();<br>
typedef int fna() __attribute ((warn_unused_result));"<br>
<br>
Do we use the Casting classes with Stmt (which has alignment<br>
attribute) as well as with other classes that don't have any<br>
attributes?<br>
<br>
Anyway, this seems like a silly warning in templates, as you're<br>
expected to use it with multiple types and they can have different<br>
attributes anyway.<br>
<br>
How is c++17 attributes going to work in this case? I assume they're<br>
going to be different types (in decltype's eyes), so GCC could do a<br>
similar implementation.<br>
<br>
cheers,<br>
--renato<br>
</blockquote></div><br></div></div>