[Bug c++/64232] New: Derived class with implicitly declared assignment operator is std::assignable though base class is not std::assignable

mmehlich at semanticdesigns dot com gcc-bugzilla@gcc.gnu.org
Tue Dec 9 01:53:00 GMT 2014


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

            Bug ID: 64232
           Summary: Derived class with implicitly declared assignment
                    operator is std::assignable though base class is not
                    std::assignable
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mmehlich at semanticdesigns dot com

Derived class with implicitly declared assignment operator is std::assignable
though the base class is not std::assignable

Code:

#include <iostream>
#include <type_traits>

struct X {
    X(const X&) = delete;
    void operator=(X x);
};

struct Y: X {
};

int main()
{
    std::cout << std::is_assignable<X&,X>::value << std::endl;
    std::cout << std::is_assignable<Y&,Y>::value << std::endl;
}

Output:
0
1



More information about the Gcc-bugs mailing list