www.digitalmars.com         C & C++   DMDScript  

c++.beta - copy constructor when returning const reference

struct A
{
 protected:
  A();
 private:
  A(const A& rhs);
};

struct B
  : public A
{ };


const A &g();
const B &h();

const A &f()
{
  return 1 ? g() : h();
  // Error: member 'A::A' of class 'A' is not accessible
}


Why does DMC need the copy constructor in this case? (Extracted from Boost's
any library - A=std::type_info, B=Type_info)


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Jun 15 2003