This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR c++/5645 gcc warns that pure virtual class not explicitly initialized


On 05/11/2007, Mark Mitchell <mark@codesourcery.com> wrote:
> Manuel, if we all agree that we don't want to warn in this situation,
> then I'd suggest that we check that the base class is nearly empty and
> that the base class copy constructor is not user-defined.  I would think
> we would certainly want to warn about:
>
> struct base {
>   base(const base& b);
>   virtual void f() = 0;
> };
>
> struct derived : public base {
>   derived(const derived &d) {}
> };
>
> because we don't know what the base class copy constructor does, but the
> fact that it is there suggests that it's author wants us to call it.

That code doesn't actually compile:

gcc/testsuite/g++.dg/warn/pr5645-2.C:13: error: no matching function
for call to 'base::base()'
gcc/testsuite/g++.dg/warn/pr5645-2.C:8: note: candidates are:
base::base(const base&)
 derived::derived(const derived&) derived::derived(const derived&)

And I am not sure how it is possible to check that the base class copy
constructor is not user-defined. I wasn't able to find an appropriate
function to do this.

Cheers,

Manu.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]