<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 17, 2014 at 6:58 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Don't drop attributes when checking explicit specializations.</div><div><br></div><div>Consider a template class with attributes on a method, and an explicit</div><div>specialization of that method:</div><div><br></div><div>    template <int></div><div>    struct A {</div><div>      void foo() final;</div><div>    };</div><div><br></div><div>    template <></div><div>    void A<0>::foo() {}</div><div><br></div><div>In this example, the attribute is `final`, but it might also be an</div><div>__attribute__((visibility("foo"))), noreturn, inline, etc. clang's current</div><div>behavior is to strip all attributes, which for some attributes is wrong</div><div>(the snippet above allows a subclass of A<0> to override the final method, for</div><div>example) and for others disagrees with gcc (__attribute__((visibility()))).</div><div><br></div><div>So stop dropping attributes. r95845 added this code without a test case, and</div><div>r176728 added the code for dropping attributes on parameters (with tests, but</div><div>they still pass).</div><div><br></div><div>As an additional wrinkle, do drop dllimport and dllexport, since that's how these two</div><div>attributes work. (This is covered by existing tests.)</div><div><br></div><div>Fixes PR21942.</div><div><br></div><div>The approach is by Richard Smith, initial analysis and typing was done by me.</div></div></blockquote><div><br></div><div>Naturally, this makes sense to me =) It also matches GCC and EDG on all attributes I tested.</div><div><br></div><div>John, do you remember why you added this code (a long long time ago)?</div></div></div></div>