Douglas Gregor | 2436e71 | 2009-09-17 21:32:03 +0000 | [diff] [blame] | 1 | struct Base1 { |
| 2 | int member1; |
| 3 | float member2; |
| 4 | }; |
| 5 | |
| 6 | struct Base2 { |
| 7 | int member1; |
| 8 | double member3; |
| 9 | void memfun1(int); |
| 10 | }; |
| 11 | |
| 12 | struct Base3 : Base1, Base2 { |
| 13 | void memfun1(float); |
Douglas Gregor | 0f62236 | 2009-12-11 18:44:16 +0000 | [diff] [blame] | 14 | void memfun1(double) const; |
Douglas Gregor | 2436e71 | 2009-09-17 21:32:03 +0000 | [diff] [blame] | 15 | void memfun2(int); |
| 16 | }; |
| 17 | |
| 18 | struct Derived : Base3 { |
| 19 | int member4; |
| 20 | int memfun3(int); |
| 21 | }; |
| 22 | |
| 23 | class Proxy { |
| 24 | public: |
| 25 | Derived *operator->() const; |
| 26 | }; |
| 27 | |
| 28 | void test(const Proxy &p) { |
Douglas Gregor | ea9b03e | 2009-09-22 21:11:38 +0000 | [diff] [blame] | 29 | p-> |
Argyrios Kyrtzidis | 0516803 | 2017-01-15 06:11:04 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | struct Test1 { |
| 33 | Base1 b; |
| 34 | |
| 35 | static void sfunc() { |
| 36 | b. // expected-error {{invalid use of member 'b' in static member function}} |
| 37 | } |
| 38 | }; |
| 39 | |
Erik Verbruggen | f1898cf | 2017-03-28 07:22:21 +0000 | [diff] [blame] | 40 | struct Foo { |
| 41 | void foo() const; |
| 42 | static void foo(bool); |
| 43 | }; |
| 44 | |
| 45 | struct Bar { |
| 46 | void foo(bool param) { |
| 47 | Foo::foo( );// unresolved member expression with an implicit base |
| 48 | } |
| 49 | }; |
| 50 | |
Daniel Dunbar | 8fbe78f | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 51 | // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s |
Douglas Gregor | 52ce62f | 2010-01-13 23:24:38 +0000 | [diff] [blame] | 52 | // CHECK-CC1: Base1 : Base1:: |
| 53 | // CHECK-CC1: member1 : [#int#][#Base1::#]member1 |
| 54 | // CHECK-CC1: member1 : [#int#][#Base2::#]member1 |
| 55 | // CHECK-CC1: member2 : [#float#][#Base1::#]member2 |
| 56 | // CHECK-CC1: member3 |
| 57 | // CHECK-CC1: member4 |
| 58 | // CHECK-CC1: memfun1 : [#void#][#Base3::#]memfun1(<#float#>) |
| 59 | // CHECK-CC1: memfun1 : [#void#][#Base3::#]memfun1(<#double#>)[# const#] |
| 60 | // CHECK-CC1: memfun1 (Hidden) : [#void#]Base2::memfun1(<#int#>) |
| 61 | // CHECK-CC1: memfun2 : [#void#][#Base3::#]memfun2(<#int#>) |
| 62 | // CHECK-CC1: memfun3 : [#int#]memfun3(<#int#>) |
Argyrios Kyrtzidis | 0516803 | 2017-01-15 06:11:04 +0000 | [diff] [blame] | 63 | |
| 64 | // Make sure this doesn't crash |
| 65 | // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:7 %s -verify |
Erik Verbruggen | f1898cf | 2017-03-28 07:22:21 +0000 | [diff] [blame] | 66 | |
| 67 | // Make sure this also doesn't crash |
| 68 | // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:47:14 %s |