xref: /minix3/external/bsd/llvm/dist/clang/test/CXX/class.derived/class.abstract/p16.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct A {
4*f4a2713aSLionel Sambuc   virtual void a(); // expected-note{{overridden virtual function is here}}
5*f4a2713aSLionel Sambuc   virtual void b() = delete; // expected-note{{overridden virtual function is here}}
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc struct B: A {
9*f4a2713aSLionel Sambuc   virtual void a() = delete; // expected-error{{deleted function 'a' cannot override a non-deleted function}}
10*f4a2713aSLionel Sambuc   virtual void b(); // expected-error{{non-deleted function 'b' cannot override a deleted function}}
11*f4a2713aSLionel Sambuc };
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc struct C: A {
14*f4a2713aSLionel Sambuc   virtual void a();
15*f4a2713aSLionel Sambuc   virtual void b() = delete;
16*f4a2713aSLionel Sambuc };
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc struct E;
19*f4a2713aSLionel Sambuc struct F;
20*f4a2713aSLionel Sambuc struct G;
21*f4a2713aSLionel Sambuc struct H;
22*f4a2713aSLionel Sambuc struct D {
23*f4a2713aSLionel Sambuc   virtual E &operator=(const E &); // expected-note {{here}}
24*f4a2713aSLionel Sambuc   virtual F &operator=(const F &);
25*f4a2713aSLionel Sambuc   virtual G &operator=(G&&); // expected-note {{here}}
26*f4a2713aSLionel Sambuc   virtual H &operator=(H&&); // expected-note {{here}}
27*f4a2713aSLionel Sambuc   friend struct F;
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc private:
30*f4a2713aSLionel Sambuc   D &operator=(const D&) = default;
31*f4a2713aSLionel Sambuc   D &operator=(D&&) = default;
32*f4a2713aSLionel Sambuc   virtual ~D(); // expected-note 2{{here}}
33*f4a2713aSLionel Sambuc };
34*f4a2713aSLionel Sambuc struct E : D {}; // expected-error {{deleted function '~E' cannot override a non-deleted function}} \
35*f4a2713aSLionel Sambuc                  // expected-error {{deleted function 'operator=' cannot override a non-deleted function}}
36*f4a2713aSLionel Sambuc struct F : D {};
37*f4a2713aSLionel Sambuc struct G : D {}; // expected-error {{deleted function '~G' cannot override a non-deleted function}}
38*f4a2713aSLionel Sambuc                  // expected-error@-1 {{deleted function 'operator=' cannot override a non-deleted function}}
39*f4a2713aSLionel Sambuc struct H : D {
40*f4a2713aSLionel Sambuc   H &operator=(H&&) = default; // expected-error {{deleted function 'operator=' cannot override a non-deleted function}}
41*f4a2713aSLionel Sambuc   ~H();
42*f4a2713aSLionel Sambuc };
43