In the following code, only Bar3 fails. What is the reason behind this static assertion failure?

#include <concepts>
struct Bar1 { Bar1() = default; bool val = false; };
static_assert(std::default_initializable<Bar1>);
struct Bar2 { Bar2() {} bool val = false; };
static_assert(std::default_initializable<Bar2>);
class Foo {
public:
    struct Bar3 { Bar3() = default; bool val = false; };
    static_assert(std::default_initializable<Bar3>);        // <-- only this one fails
    struct Bar4 { Bar4() {} bool val = false; };
    static_assert(std::default_initializable<Bar4>);
};
0

There are 0 best solutions below