virtualintf();// expected-note{{overridden virtual function is here}}
};
classB:A{
virtualvoidf();// expected-error{{virtual function 'f' has a different return type ('void') than the function it overrides (which has return type 'int')}}
virtualb*f();// expected-error{{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('struct T2::b *' is not derived from 'struct T2::a *')}}
virtuala*f();// expected-note{{overridden virtual function is here}}
};
classB:A{
virtualb*f();// expected-error{{return type of virtual function 'f' is not covariant with the return type of the function it overrides (conversion from 'struct T3::b' to inaccessible base class 'struct T3::a')}}
};
}
namespaceT4{
structa{};
structa1:a{};
structb:a,a1{};
classA{
virtuala*f();// expected-note{{overridden virtual function is here}}
virtuala*constg();// expected-note{{overridden virtual function is here}}
};
classB:A{
virtuala*constf();
virtuala*g();// expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides ('struct T5::a *' has different qualifiers than 'struct T5::a *const')}}
};
}
namespaceT6{
structa{};
classA{
virtualconsta*f();
virtuala*g();// expected-note{{overridden virtual function is here}}
};
classB:A{
virtuala*f();
virtualconsta*g();// expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides (class type 'struct T6::a const *' is more qualified than class type 'struct T6::a *'}}
structb;// expected-note {{forward declaration of 'struct T8::b'}}
classA{
virtuala*f();
};
classB:A{
b*f();// expected-error {{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('struct T8::b' is incomplete)}}
};
}
namespaceT9{
structa{};
template<typenameT>structb:a{
inta[sizeof(T)?-1:-1];// expected-error {{array size is negative}}
};
classA{
virtuala*f();
};
classB:A{
virtualb<int>*f();// expected-note {{in instantiation of template class 'struct T9::b<int>' requested here}}
virtualA&f();// expected-note {{overridden virtual function is here}}
};
structD:C{
virtualB&&f();// expected-error {{virtual function 'f' has a different return type ('struct T11::B &&') than the function it overrides (which has return type 'struct T11::A &')}}
};
};
namespaceT12{
structA{};
structB:A{};
structC{
virtualA&&f();// expected-note {{overridden virtual function is here}}
};
structD:C{
virtualB&f();// expected-error {{virtual function 'f' has a different return type ('struct T12::B &') than the function it overrides (which has return type 'struct T12::A &&')}}