为什么 std::assignable_from 返回 false?

Jin*_*Kim 6 c++ c++-concepts c++20

我正在使用 Apple Clang 并在 C++ 中包含以下代码:

struct Foo {
    int x;
    Foo& operator=(const Foo&) = default;
};

struct Bar {
    double x;

    Bar& operator=(const Foo& foo) {
        this->x = static_cast<double>(foo.x);
        return *this;
    }
};

int main(int argc, const char * argv[]) {
    static_assert(std::assignable_from<Bar&, const Foo&>, "fail");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我已经定义了一个赋值运算符 inBar来分配 from Foo。但是,std::assignable_from<Bar&, const Foo&>仍然返回false,导致静态断言失败。我的理解是std::assignable_from<Bar&, const Foo&>应该返回true,因为由于我在 中定义的自定义赋值运算符,Bar可以从对象分配对象。FooBar

我正在用 Apple Clang 编译这个。这可能是编译器问题还是我误解了std::assignable_from工作原理?有人可以解释为什么std::assignable_from<Bar&, const Foo&>退货false以及我该如何纠正这个问题吗?