Skip to content

clang-cl rejects address of constinit dllimport variable in consteval constructor call #136756

Open
@EpicRobertMillar

Description

@EpicRobertMillar

Hello, I'm trying to initialize a web of constinit objects which refer to each other (cyclically..., trying to migrate some legacy code to the data segment as much as possible) and running into an issue with clang-cl when I try and do this across dll boundaries. MSVC, clang-linux and gcc-linux accept the construction of one constinit object with a pointer to another in another dll/so, but clang-cl rejects it as not a constant expression.

Repro, with conformance viewer showing which compilers accept this and which don't.
https://godbolt.org/z/3nx6Y3nTK

Possible duplicate of these issues, posting separately because initializing a constinit variable might be considered more worthy of the necessary fixups during the dll initialization.
#125952
#50900

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-cl`clang-cl` driver. Don't use for other compiler partsconstevalC++20 consteval

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions