[Bug c++/83503] [8 Regression] bogus -Wattributes for const and pure on function template specialization

jason at redhat dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 1 15:42:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83503

--- Comment #17 from Jason Merrill <jason at redhat dot com> ---
On Wed, Jan 31, 2018 at 9:45 PM, msebor at gcc dot gnu.org
<gcc-bugzilla@gcc.gnu.org> wrote:
> Jason, I'm only starting to look into it but if I understand your suggestion
> correctly, I don't think the bug can be fixed by relying on attribute
> exclusions.
>
> Based on the test cases alone (I haven't yet stepped through the code) the
> underlying problem seems to be that explicit specializations "inherit"
> attributes from their primary template rather than starting with a clean slate.

Often that will be correct; I don't think we want to require people to
repeat all attributes on every explicit specialization.  The problem
here is that there's a conflicting attribute on the specialization,
and we want that to win, so I'm suggesting that when we see that, we
go through and remove conflicting attributes which came from the
template.


More information about the Gcc-bugs mailing list