Why explicit constructor with all default arguments can't be called from another constructor of the same class?
#include <iostream>
#include <string>
class A {
public:
explicit A(int a = 1, int b = 2) :
a_(a),
b_(b) {}
A(std::string s)
: A() {
std::cout << s;
}
int a_;
int b_;
};
int main() {
A a("!");
std::cout << a.a_;
}
g++ -v
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
g++ -o out -std=c++11 main.cpp
Error: main.cpp:12:13: error: no matching function for call to ‘A::A()’