PR c++/5645 gcc warns that pure virtual class not explicitly initialized
Manuel López-Ibáñez
lopezibanez@gmail.com
Mon Nov 12 01:33:00 GMT 2007
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.
More information about the Gcc-patches
mailing list