1// Copyright (C) 2008 N. Musatti 2// Use, modification and distribution are subject to the 3// Boost Software License, Version 1.0. (See accompanying file 4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6// See http://www.boost.org/libs/config for most recent version. 7 8// MACRO: BOOST_NO_NESTED_FRIENDSHIP 9// TITLE: Access to private members from nested classes 10// DESCRIPTION: If the compiler fails to support access to private members 11// from nested classes 12 13namespace boost_no_nested_friendship { 14 15class A { 16public: 17 A() {} 18 struct B { 19 int f(A& a) 20 { 21 a.f1(); 22 a.f2(a); 23 return a.b; 24 } 25 }; 26 27private: 28 static int b; 29 static void f1(){} 30 template <class T> 31 static void f2(const T&){} 32}; 33 34int A::b = 0; 35 36int test() 37{ 38 A a; 39 A::B b; 40 return b.f(a); 41} 42 43} 44 45