https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104282

--- Comment #8 from Fedor Chelnokov <fchelnokov at gmail dot com> ---
One more inconsistency here:

struct A {
  A() {} 
  A(A&&) = delete;
};

struct B : A { };

int main() {
    // ok in GCC
    B{ A{} };

    // error in GCC
    B b{ A{} };
}

GCC allows temporary creation B{ A{} }, but prohibits variable creation B b{
A{} }. Online demo: https://gcc.godbolt.org/z/YGjYYqo6M

It looks like both must be prohibited as in Clang (or both allowed as in MSVC).

Related discussion: https://stackoverflow.com/q/70898525/7325599

Reply via email to