Skip to content

[Clang] Layout of struct with [[msvc::no_unique_address]] is different from MSVC #159531

@philnik777

Description

@philnik777
struct S {};

struct T {
  [[msvc::no_unique_address]] S s;
};

struct V {};

struct W : T, V {};

static_assert(sizeof(W) == 1);

MSVC is happy with this code while Clang thinks sizeof(W) should be 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ABIApplication Binary Interfaceclang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:msvcDoes the clang frontend diverge from msvc on this issueduplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions