From: Niels Dekker - no reply address on
The following little program gets an unexpected warning (C4717, "recursive
on all control paths error"), and even worse: a stack overflow at runtime.

//////////////////////////////////////////////////
class Bar
{
public:
virtual ~Bar() {}
Bar() {}
template<typename U> explicit Bar(U) {}
};

class Foo : public Bar {};

int main()
{
Foo foo1;
Foo foo2 = foo1; // warning C4717
}
//////////////////////////////////////////////////

Apparently, the implicitly-defined copy-constructor of the derived class
(Foo) calls the wrong constructor of its base class (Bar). I think this is a
very serious compiler bug.

The bug was recently reported by Edward Diener (eldiener):
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=522094
The bug was encountered in VC 2008 SP1 and VC 2010 Beta (1 + 2). Please
visit the above page and vote, in order to get it fixed!

FYI, the issue has been discussed already at:

comp.std.c++ - "Templated constructor or copy constructor",
http://groups.google.com/group/comp.std.c++/browse_frm/thread/cbbe84048c24fc58/

Visual C++ Developer Center - "warning C4717 'recursive on all control paths
error' makes no sense, seems like a VC++ bug"
http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/5bde2ca8-76a3-4c07-95a3-ca49b5735154


Kind regards, Niels
--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center