27-08-2026, 11:32 AM
Hi,
I have a question regarding rule 0.2.1 on the following code:
Case (1) is clearly compliant as b has class type Base and Base has a user-provided constructor.
Case (2) is unclear, as the default constructor of Derived is not user-provided, if I understand the C++ standard correctly, as the user does not declare it at all.
Still case (2) seems fine and in line with the rule's rationale.
It would be great to get a clarification whether case (2) is considered compliant or not, and if compliant, what the intended definition of "use" should be.
Thanks a lot!
I have a question regarding rule 0.2.1 on the following code:
Code:
namespace {
struct Base {
Base() {
// do resource management
}
};
struct Derived : public Base {
// has implicit default constructor that calls user-provided Base()
};
Base b; // (1) compliant
Derived d; // (2) compliant or non-compliant for rule 0.2.1 ?
}Case (1) is clearly compliant as b has class type Base and Base has a user-provided constructor.
Case (2) is unclear, as the default constructor of Derived is not user-provided, if I understand the C++ standard correctly, as the user does not declare it at all.
Still case (2) seems fine and in line with the rule's rationale.
It would be great to get a clarification whether case (2) is considered compliant or not, and if compliant, what the intended definition of "use" should be.
Thanks a lot!

