Skip to content

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

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{};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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