• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2 
3 struct A {
4   virtual void a(); // expected-note{{overridden virtual function is here}}
5   virtual void b() = delete; // expected-note{{overridden virtual function is here}}
6 };
7 
8 struct B: A {
9   virtual void a() = delete; // expected-error{{deleted function 'a' cannot override a non-deleted function}}
10   virtual void b(); // expected-error{{non-deleted function 'b' cannot override a deleted function}}
11 };
12 
13 struct C: A {
14   virtual void a();
15   virtual void b() = delete;
16 };
17 
18 struct E;
19 struct F;
20 struct G;
21 struct H;
22 struct D {
23   virtual E &operator=(const E &); // expected-note {{here}}
24   virtual F &operator=(const F &);
25   virtual G &operator=(G&&); // expected-note {{here}}
26   virtual H &operator=(H&&); // expected-note {{here}}
27   friend struct F;
28 
29 private:
30   D &operator=(const D&) = default;
31   D &operator=(D&&) = default;
32   virtual ~D(); // expected-note 2{{here}}
33 };
34 struct E : D {}; // expected-error {{deleted function '~E' cannot override a non-deleted function}} \
35                  // expected-error {{deleted function 'operator=' cannot override a non-deleted function}}
36 struct F : D {};
37 struct G : D {}; // expected-error {{deleted function '~G' cannot override a non-deleted function}}
38                  // expected-error@-1 {{deleted function 'operator=' cannot override a non-deleted function}}
39 struct H : D {
40   H &operator=(H&&) = default; // expected-error {{deleted function 'operator=' cannot override a non-deleted function}}
41   ~H();
42 };
43