Argyrios Kyrtzidis | 799ef66 | 2011-02-03 18:01:15 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -Woverloaded-virtual -verify %s |
| 2 | |
| 3 | struct B1 { |
| 4 | virtual void foo(int); // expected-note {{declared here}} |
| 5 | virtual void foo(); // expected-note {{declared here}} |
| 6 | }; |
| 7 | |
| 8 | struct S1 : public B1 { |
| 9 | void foo(float); // expected-warning {{hides overloaded virtual functions}} |
| 10 | }; |
| 11 | |
| 12 | struct S2 : public B1 { |
| 13 | void foo(); // expected-note {{declared here}} |
| 14 | }; |
| 15 | |
| 16 | struct B2 { |
| 17 | virtual void foo(void*); // expected-note {{declared here}} |
| 18 | }; |
| 19 | |
| 20 | struct MS1 : public S2, public B2 { |
| 21 | virtual void foo(int); // expected-warning {{hides overloaded virtual functions}} |
| 22 | }; |
| 23 | |
| 24 | struct B3 { |
| 25 | virtual void foo(int); |
| 26 | virtual void foo(); |
| 27 | }; |
| 28 | |
| 29 | struct S3 : public B3 { |
| 30 | using B3::foo; |
| 31 | void foo(float); |
| 32 | }; |
| 33 | |
| 34 | struct B4 { |
| 35 | virtual void foo(); |
| 36 | }; |
| 37 | |
| 38 | struct S4 : public B4 { |
| 39 | void foo(float); |
| 40 | void foo(); |
| 41 | }; |
Argyrios Kyrtzidis | 74b47f9 | 2011-02-10 18:13:41 +0000 | [diff] [blame] | 42 | |
| 43 | namespace PR9182 { |
| 44 | struct Base { |
| 45 | virtual void foo(int); |
| 46 | }; |
| 47 | |
| 48 | void Base::foo(int) { } |
| 49 | |
| 50 | struct Derived : public Base { |
| 51 | virtual void foo(int); |
| 52 | void foo(int, int); |
| 53 | }; |
| 54 | } |
Argyrios Kyrtzidis | 0266aa3 | 2011-03-03 22:58:57 +0000 | [diff] [blame] | 55 | |
| 56 | namespace PR9396 { |
| 57 | class A { |
| 58 | public: |
| 59 | virtual void f(int) {} |
| 60 | }; |
| 61 | |
| 62 | class B : public A { |
| 63 | public: |
| 64 | static void f() {} |
| 65 | }; |
| 66 | } |