Skip to content

<mutex> : std::mutex::mutex is not constexpr #2285

@tiagomacarios

Description

@tiagomacarios

This is mentioned in other issues, but I wanted a bug report tracking this explicitly. For the curious see #946.

std::mutex::mutex is constexpr as of c++11, but even in c++17 MSVC will not support it.
Minimal repro:
https://godbolt.org/z/5Yc56hEG7

#include <mutex>

struct S {
    constexpr S() noexcept = default;
    std::mutex m_mutex;
};

static constexpr S s{};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions