When the use declaration is used to inherit constructors, this requires a direct base class [namespace.udecl] / 3
If such a utility declaration is called by the constructor, the sub-name specifier must indicate the direct base class of the class being defined; otherwise, it enters the set of ads found when searching for the member name.
those. in your case, the use-declaration in OperationFailedBecauseFileDoesNotExistError does not inherit, but re-declares (as an alias) or displays the name ctor ExceptionBase .
You need to write a non-inheriting ctor for OperationFailedBecauseFileDoesNotExistError .
By the way, this is normal for non-virtual base classes: the declaration of use for ctors inheritance is rewritten as:
Since you can only initialize a direct base class (or virtual base class) in the mem-initializer list, it makes sense for non-virtual base classes to restrict the use of declarations to inheriting ctors only from direct base classes.
The authors of the ctors inheritance proposal knew that this violated the support for the ctors virtual base classes, see N2540 :
As a rule, inheritance of design definitions for classes with virtual databases will be poorly formed, unless the virtual database supports initialization by default, or the virtual database is a direct database and is called a redirected database. Similarly, all data members and other direct databases must support initialization by default, or any attempt to use the inheriting constructor will be poorly formed. Note: poorly formed when used, not announced.
source share