You're missing a semicolon after your struct
definition.
The error is correct, constructors have no return type. Because you're missing a semicolon, that entire struct definition is seen as a return type for a function, as in:
// vvv return type vvv
struct { /* stuff */ } foo(void)
{
}
Add your semicolon:
struct B
{
int* a;
B(int value):a(new int(value))
{ }
B():a(nullptr){}
B(const B&);
}; // end class definition
// ah, no return type
B::B(const B& pattern)
{
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…