C++ optional initialization issue with Clang?

Viewed 34

Following code compiles fine in C++20 with MSVC and GCC, but fails with clang.

#include <optional>
#include <string>

using namespace std;

struct A {
  string s;
};

int main() {
  [[maybe_unused]] optional<A> a{in_place, "hello"};
}

Check this link.

It fails with C++17 in all 3 compilers. Is this a clang C++20 bug?

0 Answers
Related