Clang Project

clang_source_code/test/CXX/class.access/class.access.nest/p1.cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// Derived from GNU's std::string
4namespace test0 {
5  class A {
6    struct B {
7      unsigned long length;
8    };
9    struct C : B {
10      static const unsigned long max_length;
11    };
12  };
13  
14  const unsigned long A::C::max_length = sizeof(B);
15}
16
17// Example from the standard.
18namespace test1 {
19  class E {
20    int x;
21    class B {};
22
23    class I {
24      B b;
25      int y; // expected-note {{declared private here}}
26      void f(E* p, int i) {
27        p->x = i;
28      }
29    };
30
31    int g(I* p) { return p->y; } // expected-error {{'y' is a private member of 'test1::E::I'}}
32  };
33}
34