blob: 5c0dcf34d2148eee394690dab306c627eb98e085 [file] [log] [blame]
John McCall2f514482010-01-27 03:50:35 +00001// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
2
3// C++0x [class.access]p6:
4// All access controls in [class.access] affect the ability to
5// access a class member name from a particular scope. For purposes
6// of access control, the base-specifiers of a class and the
7// definitions of class members that appear outside of the class
8// definition are considered to be within the scope of that
9// class. In particular, access controls apply as usual to member
10// names accessed as part of a function return type, even though it
11// is not possible to determine the access privileges of that use
12// without first parsing the rest of the function
13// declarator. Similarly, access control for implicit calls to the
14// constructors, the conversion functions, or the destructor called
15// to create and destroy a static data member is performed as if
16// these calls appeared in the scope of the member's class.
17
18namespace test0 {
19 class A {
20 typedef int type; // expected-note {{declared private here}}
21 type foo();
22 };
23
24 A::type foo() { } // expected-error {{access to private member}}
25 A::type A::foo() { }
26}