C ++ 11 наследование конструктора и конструкторы без параметров
В этом фрагменте кода почему конструктор A без параметров не наследуется? Существует ли специальное правило, которое запрещает наследовать конструкторы без параметров?
struct A {
A(void *) {}
A() {}
};
class B : public A {
public:
using A::A;
B(int x) {}
};
void f() {
B b(1);
B b2(nullptr);
B b3; // error
}
clang ++ -std = c ++ 11 выдает эту ошибку, а g ++ -std = c ++ 11 выдает по существу аналогичное сообщение об ошибке:
td.cpp:15:7: error: no matching constructor for initialization of 'B'
B b3; // error
^
td.cpp:9:5: note: candidate constructor not viable: requires single argument 'x', but no arguments
were provided
B(int x) {}
^
td.cpp:8:14: note: candidate constructor (inherited) not viable: requires 1 argument, but 0 were
provided
using A::A;
^
td.cpp:2:5: note: inherited from here
A(void *) {}