blob: d2c3dc36075bb9bc4442ac260c6cdbd1c78fde90 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
struct Base1 {
virtual void g();
};
struct A : Base1 {
virtual void g() override override; // expected-error {{class member already marked 'override'}}
virtual void h() final final; // expected-error {{class member already marked 'final'}}
};
struct Base2 {
virtual void e1(), e2();
virtual void f();
};
struct B : Base2 {
virtual void e1() override, e2(int); // No error.
virtual void f() override;
void g() override; // expected-error {{only virtual member functions can be marked 'override'}}
int h override; // expected-error {{only virtual member functions can be marked 'override'}}
};
struct C {
virtual void f() final;
void g() final; // expected-error {{only virtual member functions can be marked 'final'}}
int h final; // expected-error {{only virtual member functions can be marked 'final'}}
};
namespace inline_extension {
struct Base1 {
virtual void g() {}
};
struct A : Base1 {
virtual void g() override override {} // expected-error {{class member already marked 'override'}}
virtual void h() final final {} // expected-error {{class member already marked 'final'}}
};
struct Base2 {
virtual void f();
};
struct B : Base2 {
virtual void f() override {}
void g() override {} // expected-error {{only virtual member functions can be marked 'override'}}
};
struct C {
virtual void f() final {}
void g() final {} // expected-error {{only virtual member functions can be marked 'final'}}
};
}
|