Skip to content

Clang rejects valid int iarr [10] alignas(Required);  #106551

Open
@ranaanoop

Description

@ranaanoop

The following valid program is rejected by clang but accepted by both gcc and msvc. Demo

constexpr std::size_t Required=16;

int iarr [10] alignas(Required); 

Clang says:

<source>:16:15: error: 'alignas' attribute cannot be applied to types
   16 | int iarr [10] alignas(Required); 
      |          

Note that if you move [10] to after alignas(Required) then clang also starts accepting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"rejects-valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions