p4.cpp revision 10f2873c0df7f662bfdb9a3e8bc834b68c1ead48
1c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
2c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall
3c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall// C++0x [class.access]p4:
4c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall
5c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall//   Access control is applied uniformly to all names, whether the
6c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall//   names are referred to from declarations or expressions.  In the
7c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall//   case of overloaded function names, access control is applied to
8c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall//   the function selected by overload resolution.
9c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall
10c373d48502ca7683ab55385f5bd624d778eb288dJohn McCallclass Public {} PublicInst;
11c373d48502ca7683ab55385f5bd624d778eb288dJohn McCallclass Protected {} ProtectedInst;
12c373d48502ca7683ab55385f5bd624d778eb288dJohn McCallclass Private {} PrivateInst;
13c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall
14c373d48502ca7683ab55385f5bd624d778eb288dJohn McCallnamespace test0 {
15c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall  class A {
16c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall  public:
17c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall    void foo(Public&);
18c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall  protected:
19c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall    void foo(Protected&); // expected-note 2 {{declared protected here}}
20c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall  private:
21c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall    void foo(Private&); // expected-note 2 {{declared private here}}
22c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall  };
23c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall
24c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall  void test(A *op) {
25c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall    op->foo(PublicInst);
266b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    op->foo(ProtectedInst); // expected-error {{'foo' is a protected member}}
276b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    op->foo(PrivateInst); // expected-error {{'foo' is a private member}}
28c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall
29c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall    void (A::*a)(Public&) = &A::foo;
306b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    void (A::*b)(Protected&) = &A::foo; // expected-error {{'foo' is a protected member}}
316b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    void (A::*c)(Private&) = &A::foo; // expected-error {{'foo' is a private member}}
32c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall  }
33c373d48502ca7683ab55385f5bd624d778eb288dJohn McCall}
345357b615364c17ea024c757354c58ae2a520d216John McCall
355357b615364c17ea024c757354c58ae2a520d216John McCall// Member operators.
365357b615364c17ea024c757354c58ae2a520d216John McCallnamespace test1 {
375357b615364c17ea024c757354c58ae2a520d216John McCall  class A {
385357b615364c17ea024c757354c58ae2a520d216John McCall  public:
395357b615364c17ea024c757354c58ae2a520d216John McCall    void operator+(Public&);
405357b615364c17ea024c757354c58ae2a520d216John McCall    void operator[](Public&);
4141d8903731782ee85ee2b19734008b006e01c76fJohn McCall    void operator()(Public&);
42233a6419097ed97b67ff8efcacef9af613262ca3John McCall    typedef void (*PublicSurrogate)(Public&);
43233a6419097ed97b67ff8efcacef9af613262ca3John McCall    operator PublicSurrogate() const;
445357b615364c17ea024c757354c58ae2a520d216John McCall  protected:
455357b615364c17ea024c757354c58ae2a520d216John McCall    void operator+(Protected&); // expected-note {{declared protected here}}
465357b615364c17ea024c757354c58ae2a520d216John McCall    void operator[](Protected&); // expected-note {{declared protected here}}
4741d8903731782ee85ee2b19734008b006e01c76fJohn McCall    void operator()(Protected&); // expected-note {{declared protected here}}
48233a6419097ed97b67ff8efcacef9af613262ca3John McCall    typedef void (*ProtectedSurrogate)(Protected&);
49233a6419097ed97b67ff8efcacef9af613262ca3John McCall    operator ProtectedSurrogate() const; // expected-note {{declared protected here}}
505357b615364c17ea024c757354c58ae2a520d216John McCall  private:
515357b615364c17ea024c757354c58ae2a520d216John McCall    void operator+(Private&); // expected-note {{declared private here}}
525357b615364c17ea024c757354c58ae2a520d216John McCall    void operator[](Private&); // expected-note {{declared private here}}
5341d8903731782ee85ee2b19734008b006e01c76fJohn McCall    void operator()(Private&); // expected-note {{declared private here}}
545357b615364c17ea024c757354c58ae2a520d216John McCall    void operator-(); // expected-note {{declared private here}}
55233a6419097ed97b67ff8efcacef9af613262ca3John McCall    typedef void (*PrivateSurrogate)(Private&);
56233a6419097ed97b67ff8efcacef9af613262ca3John McCall    operator PrivateSurrogate() const; // expected-note {{declared private here}}
575357b615364c17ea024c757354c58ae2a520d216John McCall  };
585357b615364c17ea024c757354c58ae2a520d216John McCall  void operator+(const A &, Public&);
595357b615364c17ea024c757354c58ae2a520d216John McCall  void operator+(const A &, Protected&);
605357b615364c17ea024c757354c58ae2a520d216John McCall  void operator+(const A &, Private&);
615357b615364c17ea024c757354c58ae2a520d216John McCall  void operator-(const A &);
625357b615364c17ea024c757354c58ae2a520d216John McCall
635357b615364c17ea024c757354c58ae2a520d216John McCall  void test(A &a, Public &pub, Protected &prot, Private &priv) {
645357b615364c17ea024c757354c58ae2a520d216John McCall    a + pub;
656b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    a + prot; // expected-error {{'operator+' is a protected member}}
666b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    a + priv; // expected-error {{'operator+' is a private member}}
675357b615364c17ea024c757354c58ae2a520d216John McCall    a[pub];
686b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    a[prot]; // expected-error {{'operator[]' is a protected member}}
696b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    a[priv]; // expected-error {{'operator[]' is a private member}}
7041d8903731782ee85ee2b19734008b006e01c76fJohn McCall    a(pub);
716b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    a(prot); // expected-error {{'operator()' is a protected member}}
726b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    a(priv); // expected-error {{'operator()' is a private member}}
736b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    -a;       // expected-error {{'operator-' is a private member}}
745357b615364c17ea024c757354c58ae2a520d216John McCall
755357b615364c17ea024c757354c58ae2a520d216John McCall    const A &ca = a;
765357b615364c17ea024c757354c58ae2a520d216John McCall    ca + pub;
775357b615364c17ea024c757354c58ae2a520d216John McCall    ca + prot;
785357b615364c17ea024c757354c58ae2a520d216John McCall    ca + priv;
795357b615364c17ea024c757354c58ae2a520d216John McCall    -ca;
80233a6419097ed97b67ff8efcacef9af613262ca3John McCall    // These are all surrogate calls
81233a6419097ed97b67ff8efcacef9af613262ca3John McCall    ca(pub);
826b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    ca(prot); // expected-error {{'operator void (*)(class Protected &)' is a protected member}}
836b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall    ca(priv); // expected-error {{'operator void (*)(class Private &)' is a private member}}
845357b615364c17ea024c757354c58ae2a520d216John McCall  }
855357b615364c17ea024c757354c58ae2a520d216John McCall}
864f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall
874f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall// Implicit constructor calls.
884f9506a27cb6b865bf38beea48eadfa9dc93f510John McCallnamespace test2 {
894f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall  class A {
904f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall  private:
914f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall    A(); // expected-note {{declared private here}}
924f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall
934f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall    static A foo;
944f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall  };
954f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall
966b2accb4793e16b2e93a8c2589f5df702231f17aJohn McCall  A a; // expected-error {{calling a private constructor}}
974f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall  A A::foo; // okay
984f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall}
994f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall
1004f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall// Implicit destructor calls.
1014f9506a27cb6b865bf38beea48eadfa9dc93f510John McCallnamespace test3 {
10258e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  class A {
1034f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall  private:
1044f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall    ~A(); // expected-note 3 {{declared private here}}
1054f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall    static A foo;
1064f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall  };
1074f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall
10858e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  A a; // expected-error {{variable of type 'test3::A' has private destructor}}
1094f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall  A A::foo;
1104f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall
11158e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  void foo(A param) { // expected-error {{variable of type 'test3::A' has private destructor}}
11258e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall    A local; // expected-error {{variable of type 'test3::A' has private destructor}}
1134f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall  }
11458e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall
115ef027fe748894522653558d9475a220482395094John McCall  template <unsigned N> class Base { ~Base(); }; // expected-note 14 {{declared private here}}
116ef027fe748894522653558d9475a220482395094John McCall  class Base2 : virtual Base<2> { ~Base2(); }; // expected-note 3 {{declared private here}} \
117ef027fe748894522653558d9475a220482395094John McCall                                               // expected-error {{base class 'Base<2>' has private destructor}}
118ef027fe748894522653558d9475a220482395094John McCall  class Base3 : virtual Base<3> { public: ~Base3(); }; // expected-error {{base class 'Base<3>' has private destructor}}
11958e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall
12058e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  // These don't cause diagnostics because we don't need the destructor.
12158e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  class Derived0 : Base<0> { ~Derived0(); };
12258e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  class Derived1 : Base<1> { };
12358e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall
12458e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  class Derived2 : // expected-error {{inherited virtual base class 'Base<2>' has private destructor}} \
12558e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall                   // expected-error {{inherited virtual base class 'Base<3>' has private destructor}}
12658e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall    Base<0>,  // expected-error {{base class 'Base<0>' has private destructor}}
12758e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall    virtual Base<1>, // expected-error {{base class 'Base<1>' has private destructor}}
12858e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall    Base2, // expected-error {{base class 'test3::Base2' has private destructor}}
12958e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall    virtual Base3
13058e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  {
13158e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall    ~Derived2() {}
13258e6f34e4d2c668562e1c391162ee9de7b05fbb2John McCall  };
1336c790eac94101407acfd2c664400924cab45c0b1John McCall
134ef027fe748894522653558d9475a220482395094John McCall  class Derived3 : // expected-error 2 {{inherited virtual base class 'Base<2>' has private destructor}} \
135ef027fe748894522653558d9475a220482395094John McCall                   // expected-error 2 {{inherited virtual base class 'Base<3>' has private destructor}}
136ef027fe748894522653558d9475a220482395094John McCall    Base<0>,  // expected-error 2 {{base class 'Base<0>' has private destructor}}
137ef027fe748894522653558d9475a220482395094John McCall    virtual Base<1>, // expected-error 2 {{base class 'Base<1>' has private destructor}}
138ef027fe748894522653558d9475a220482395094John McCall    Base2, // expected-error 2 {{base class 'test3::Base2' has private destructor}}
1396c790eac94101407acfd2c664400924cab45c0b1John McCall    virtual Base3
1406c790eac94101407acfd2c664400924cab45c0b1John McCall  {};
1416c790eac94101407acfd2c664400924cab45c0b1John McCall  Derived3 d3;
1424f9506a27cb6b865bf38beea48eadfa9dc93f510John McCall}
143b05b5f35f114505182b076aa70002843c0669bebJohn McCall
144b05b5f35f114505182b076aa70002843c0669bebJohn McCall// Conversion functions.
145b05b5f35f114505182b076aa70002843c0669bebJohn McCallnamespace test4 {
146b05b5f35f114505182b076aa70002843c0669bebJohn McCall  class Base {
147b05b5f35f114505182b076aa70002843c0669bebJohn McCall  private:
148b05b5f35f114505182b076aa70002843c0669bebJohn McCall    operator Private(); // expected-note 4 {{declared private here}}
149b05b5f35f114505182b076aa70002843c0669bebJohn McCall  public:
150b05b5f35f114505182b076aa70002843c0669bebJohn McCall    operator Public();
151b05b5f35f114505182b076aa70002843c0669bebJohn McCall  };
152b05b5f35f114505182b076aa70002843c0669bebJohn McCall
153b05b5f35f114505182b076aa70002843c0669bebJohn McCall  class Derived1 : private Base { // expected-note 2 {{declared private here}} \
154b05b5f35f114505182b076aa70002843c0669bebJohn McCall                                  // expected-note {{constrained by private inheritance}}
155b05b5f35f114505182b076aa70002843c0669bebJohn McCall    Private test1() { return *this; } // expected-error {{'operator Private' is a private member}}
156b05b5f35f114505182b076aa70002843c0669bebJohn McCall    Public test2() { return *this; }
157b05b5f35f114505182b076aa70002843c0669bebJohn McCall  };
158b05b5f35f114505182b076aa70002843c0669bebJohn McCall  Private test1(Derived1 &d) { return d; } // expected-error {{'operator Private' is a private member}} \
159b05b5f35f114505182b076aa70002843c0669bebJohn McCall                                           // expected-error {{cannot cast 'test4::Derived1' to its private base class}}
160b05b5f35f114505182b076aa70002843c0669bebJohn McCall  Public test2(Derived1 &d) { return d; } // expected-error {{cannot cast 'test4::Derived1' to its private base class}} \
161b05b5f35f114505182b076aa70002843c0669bebJohn McCall                                          // expected-error {{'operator Public' is a private member}}
162b05b5f35f114505182b076aa70002843c0669bebJohn McCall
163b05b5f35f114505182b076aa70002843c0669bebJohn McCall
164b05b5f35f114505182b076aa70002843c0669bebJohn McCall  class Derived2 : public Base {
165b05b5f35f114505182b076aa70002843c0669bebJohn McCall    Private test1() { return *this; } // expected-error {{'operator Private' is a private member}}
166b05b5f35f114505182b076aa70002843c0669bebJohn McCall    Public test2() { return *this; }
167b05b5f35f114505182b076aa70002843c0669bebJohn McCall  };
168b05b5f35f114505182b076aa70002843c0669bebJohn McCall  Private test1(Derived2 &d) { return d; } // expected-error {{'operator Private' is a private member}}
169b05b5f35f114505182b076aa70002843c0669bebJohn McCall  Public test2(Derived2 &d) { return d; }
170b05b5f35f114505182b076aa70002843c0669bebJohn McCall
171b05b5f35f114505182b076aa70002843c0669bebJohn McCall  class Derived3 : private Base { // expected-note {{constrained by private inheritance here}} \
172b05b5f35f114505182b076aa70002843c0669bebJohn McCall                                  // expected-note {{declared private here}}
173b05b5f35f114505182b076aa70002843c0669bebJohn McCall  public:
174b05b5f35f114505182b076aa70002843c0669bebJohn McCall    operator Private();
175b05b5f35f114505182b076aa70002843c0669bebJohn McCall  };
176b05b5f35f114505182b076aa70002843c0669bebJohn McCall  Private test1(Derived3 &d) { return d; }
177b05b5f35f114505182b076aa70002843c0669bebJohn McCall  Public test2(Derived3 &d) { return d; } // expected-error {{'operator Public' is a private member of 'test4::Base'}} \
178b05b5f35f114505182b076aa70002843c0669bebJohn McCall                                          // expected-error {{cannot cast 'test4::Derived3' to its private base class}}
179b05b5f35f114505182b076aa70002843c0669bebJohn McCall
180b05b5f35f114505182b076aa70002843c0669bebJohn McCall  class Derived4 : public Base {
181b05b5f35f114505182b076aa70002843c0669bebJohn McCall  public:
182b05b5f35f114505182b076aa70002843c0669bebJohn McCall    operator Private();
183b05b5f35f114505182b076aa70002843c0669bebJohn McCall  };
184b05b5f35f114505182b076aa70002843c0669bebJohn McCall  Private test1(Derived4 &d) { return d; }
185b05b5f35f114505182b076aa70002843c0669bebJohn McCall  Public test2(Derived4 &d) { return d; }
186b05b5f35f114505182b076aa70002843c0669bebJohn McCall}
187b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall
188b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall// Implicit copy assignment operator uses.
189b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCallnamespace test5 {
190b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  class A {
191b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    void operator=(const A &); // expected-note 2 {{declared private here}}
192b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  };
193b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall
194b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  class Test1 { A a; }; // expected-error {{field of type 'test5::A' has private copy assignment operator}}
195b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  void test1() {
196b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    Test1 a;
197b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    a = Test1();
198b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  }
199b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall
200b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  class Test2 : A {}; // expected-error {{base class 'test5::A' has private copy assignment operator}}
201b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  void test2() {
202b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    Test2 a;
203b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    a = Test2();
204b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  }
205b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall}
206b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall
207b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall// Implicit copy constructor uses.
208b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCallnamespace test6 {
209b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  class A {
210b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    public: A();
211b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    private: A(const A &); // expected-note 2 {{declared private here}}
212b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  };
213b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall
214b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  class Test1 { A a; }; // expected-error {{field of type 'test6::A' has private copy constructor}}
215b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  void test1(const Test1 &t) {
216b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    Test1 a = t;
217b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  }
218b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall
219b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  class Test2 : A {}; // expected-error {{base class 'test6::A' has private copy constructor}}
220b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  void test2(const Test2 &t) {
221b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall    Test2 a = t;
222b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall  }
223b020748a9954c995f2e616f50bb9ed4fe2df1f72John McCall}
22410f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall
22510f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall// Redeclaration lookups are not accesses.
22610f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCallnamespace test7 {
22710f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall  class A {
22810f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall    int private_member;
22910f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall  };
23010f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall  class B : A {
23110f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall    int foo(int private_member) {
23210f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall      return 0;
23310f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall    }
23410f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall  };
23510f2873c0df7f662bfdb9a3e8bc834b68c1ead48John McCall}
236