Why the B(B&) ctor is called, instead of B(const B&), in the construction of object b1 ?
#include <iostream>
using namespace std;
struct B
{
int i;
B() : i(2) { }
B(B& x) : i(x.i) { cout << "Copy constructor B(B&), i = " << i << endl; }
B(const B& x) : i(x.i) { cout << "Copy constructor B(const B&), i = " << i << endl; }
};
int main()
{
B b;
B b1(b);
}
13.3.3.2/3 says
In your case since the argument is non-const, the non-const version of the copy c-tor is chosen because it is a better match.