Here is a piece of code:
class A {
public:
void f() {}
};
int main()
{
A a; // OK
const A b; // ERROR
a.f();
return 0;
}
This gives the following error: Default initialisation of an object of const type 'const A' requires a user-provided default constructor
What is the logic behind this ?