Skip to content

std::variant<std::string>{}.index() is not an integral constant expression #86686

@hewillk

Description

@hewillk

Clang rejects the following.
Not sure if it's just because a certain language feature isn't implemented yet, correct me if I'm missing something.

#include <variant>
#include <string>

static_assert(std::variant<std::string>{}.index() == 0);

https://godbolt.org/z/8cTnafsMd

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions