If I have code like the following:
class Base { /* ... */};
class Derived : public Base { /* ... */ };
int main() {
Base b = Derived{};
}
Then the code exhibits the slicing problem. Any data that is part of class Derived but not part of class Base is lost. But suppose that Derived doesn't have any data members or base classes that aren't in Base, so there is no data to lose.
Does this code still exhibit undefined behavior or other problems?