From: Florian on
> Defining the constructor in the class declaration causes (requests) it to be
> "inlined", such that code for the function doesn't normally get inserted into
> your compiler's object code except at the point where it's called--but it's
> not called from anywhere in your example and so no code is generated; the
> linker never sees it. (Of course, if the compiler opts to not inline the
> ctor afterall, then you would see the linker error in both of your examples.)

I think it's wrong.

struct A
virtual void foo() {}

A::A() {foo();}

These don't lead to linker error.

@Daniel Kr�gler: Are you sure it's a UB ? Il could make unexpected
behavior in inherited class because in constructor of base class, type
is base never derived, so it isn't call the expected function, but it
isn't undefined.

[ See for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]