1 // RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
5 virtual int f(); // expected-note{{overridden virtual function is here}}
9 virtual void f(); // expected-error{{virtual function 'f' has a different return type ('void') than the function it overrides (which has return type 'int')}}
20 virtual a* f(); // expected-note{{overridden virtual function is here}}
24 virtual b* 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 *')}}
32 struct b : private a { }; // expected-note{{'private' inheritance specifier here}}
35 virtual a* f(); // expected-note{{overridden virtual function is here}}
39 virtual b* 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')}}
51 virtual a* f(); // expected-note{{overridden virtual function is here}}
55 virtual b* f(); // expected-error{{return type of virtual function 'f' is not covariant with the return type of the function it overrides (ambiguous conversion from derived class 'struct T4::b' to base class 'struct T4::a':\n\
56 struct T4::b -> struct T4::a\n\
57 struct T4::b -> struct T4::a1 -> struct T4::a)}}
68 virtual a* const g(); // expected-note{{overridden virtual function is here}}
73 virtual a* 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')}}
84 virtual a* g(); // expected-note{{overridden virtual function is here}}
89 virtual const a* 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 *'}}
109 struct b; // expected-note {{forward declaration of 'struct T8::b'}}
116 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)}}
123 template<typename T> struct b : a {
124 int a[sizeof(T) ? -1 : -1]; // expected-error {{array size is negative}}
132 virtual b<int> *f(); // expected-note {{in instantiation of template class 'struct T9::b<int>' requested here}}
140 class X1 : public X0 {
144 template <typename Base>
146 void f(int) = 0; // expected-error{{not virtual and cannot be declared pure}}
149 struct Base1 { virtual void f(int); };
153 (void)sizeof(Foo<Base1>);
154 (void)sizeof(Foo<Base2>); // expected-note{{instantiation}}
157 template<typename Base>
159 template<typename T> int f(T);
170 virtual void f(int) = 0; // expected-note{{pure virtual function}}
179 Bar3<int> b3i; // okay
180 Bar3<float> b3f; // expected-error{{is an abstract class}}
187 template <typename T>
188 class Derived : public Base {};
192 virtual Base* Method();
195 class Bar : public Foo {
197 virtual Derived<int>* Method();