Skip to content

clang drops alignsas on struct field #95032

@ahatanak

Description

@ahatanak

$ cat test.c

#include <assert.h>

struct S {
  alignas(16) char bytes[16];
};

static_assert(alignof(struct S) == 16);

$ clang -std=c2x test.c -c -o /dev/null

<source>:7:15: error: static assertion failed due to requirement '_Alignof(struct S) == 16'
    7 | static_assert(alignof(struct S) == 16);
      |               ^~~~~~~~~~~~~~~~~~~~~~~
<source>:7:33: note: expression evaluates to '1 == 16'
    7 | static_assert(alignof(struct S) == 16);
      |               ~~~~~~~~~~~~~~~~~~^~~~~
1 error generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyregression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions