1 class X {
2 public:
3  int pub;
4 protected:
5  int prot;
6 private:
7  int priv;
8 };
9 
10 class Unrelated {
11 public:
12   static int pub;
13 protected:
14   static int prot;
15 private:
16   static int priv;
17 };
18 
19 class Y : public X {
20   int test() {
21     this->pub = 10;
22     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:11 %s -o - \
23     // RUN: | FileCheck -check-prefix=THIS %s
24     // THIS: priv (InBase,Inaccessible)
25     // THIS: prot (InBase)
26     // THIS: pub (InBase)
27     //
28     // Also check implicit 'this->', i.e. complete at the start of the line.
29     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:1 %s -o - \
30     // RUN: | FileCheck -check-prefix=THIS %s
31 
32     X().pub + 10;
33     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:32:9 %s -o - \
34     // RUN: | FileCheck -check-prefix=X-OBJ %s
35     // X-OBJ: priv (Inaccessible)
36     // X-OBJ: prot (Inaccessible)
37     // X-OBJ: pub : [#int#]pub
38 
39     Y().pub + 10;
40     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:39:9 %s -o - \
41     // RUN: | FileCheck -check-prefix=Y-OBJ %s
42     // Y-OBJ: priv (InBase,Inaccessible)
43     // Y-OBJ: prot (InBase)
44     // Y-OBJ: pub (InBase)
45 
46     this->X::pub = 10;
47     X::pub = 10;
48     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:46:14 %s -o - \
49     // RUN: | FileCheck -check-prefix=THIS-BASE %s
50     //
51     // THIS-BASE: priv (Inaccessible)
52     // THIS-BASE: prot : [#int#]prot
53     // THIS-BASE: pub : [#int#]pub
54     //
55     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:47:8 %s -o - \
56     // RUN: | FileCheck -check-prefix=THIS-BASE %s
57 
58 
59     this->Unrelated::pub = 10; // a check we don't crash in this cases.
60     Y().Unrelated::pub = 10; // a check we don't crash in this cases.
61     Unrelated::pub = 10;
62     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:59:22 %s -o - \
63     // RUN: | FileCheck -check-prefix=UNRELATED %s
64     // UNRELATED: priv (Inaccessible)
65     // UNRELATED: prot (Inaccessible)
66     // UNRELATED: pub : [#int#]pub
67     //
68     // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:60:20 %s -o - \
69     // RUN: | FileCheck -check-prefix=UNRELATED %s
70     // RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:61:16 %s -o - \
71     // RUN: | FileCheck -check-prefix=UNRELATED %s
72   }
73 };
74