I just have this code, and I wonder why this code compiles in C++20 and later, but it doesn't compile in C++17 and earlier.
struct B {
B(int){};
};
struct D : B {
};
int main() {
D d = D(10);
}
I know that inheriting constructors is a C++11 feature. But class D doesn't inherit the B::B(int) constructor, even though this line D d = D(10); compiles. My question is, why does it compile only in C++20 and not in C++17? Is there a quote to the C++ standard that applies here?
I am using g++11.2.0.