This code: #include <memory> class foo { protected: foo() {} foo(int) {} public: };
class bar : public foo { public: bar() : foo() { new (this) foo(5); } }; bar b; gets you: ~/ootbc/sim$ g++ foo.cc foo.cc: In constructor bar::bar(): foo.cc:5: error: foo::foo(int) is protected foo.cc:12: error: within this context -- Summary: Placement new not seeing base class protected functions Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41050