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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-06-12
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to zhonghao from comment #0)
> My gcc is 10.0.0, and the code is:
> 
> template <int N> 
> void test() {
>  constexpr int N2 = N;
>  typedef int T alignas(N2);
>  // error: requested alignment is not an integer constant

What is this comment here for? G++ does not give this error, and it should not
give this error. Neither Clang nor icc gives this error either.

It's not helpful to provide code with misleading comments about bogus errors.
It makes it look like the comment is somehow relevant to your bug report, and
it's not.

Anyway, confirmed, G++ should issue a diagnostic here:

 An alignment-specifier may be applied to a variable or to a class data member,
 but it shall not be applied to a bit-field, a function parameter, or an
 exception-declaration (14.3). An alignment-specifier may also be applied to
 the declaration of a class (in an elaborated-type-specifier (9.1.7.3) or
 class-head (Clause 11), respectively).

Reply via email to