This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/84158] [6/7/8 Regression] missing -Wreturn-type due to incorrect handling of attributes for template specializations
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Feb 2018 15:46:52 +0000
- Subject: [Bug c++/84158] [6/7/8 Regression] missing -Wreturn-type due to incorrect handling of attributes for template specializations
- Auto-submitted: auto-generated
- References: <bug-84158-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84158
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> As C++ now has standardized attributes, the question is what does the
> standard say about whether standard attributes on a template are inherited
> to specializations or not, and if the standard is fuzzy about it, what do
> other compilers do.
To my reading the standard doesn't specify attributes with enough detail to
answer the question, but inheriting attributes wouldn't make sense. For
another example, consider class templates and alignas:
template <class T>
struct alignas (32) A { T a; };
template <>
struct A<int> { char c; };
static_assert (alignof (A<int>) < 32, "alignof A<int> < 32");
This passes with all compilers I tried, including Clang, GCC, ICC, and MSVC.
It would be most surprising if the rules for class templates were different
than for function templates.