Files

45 lines
882 B
C++
Raw Permalink Normal View History

2008-10-11 15:47:59 +00:00
// Copyright (C) 2008 N. Musatti
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_NO_NESTED_FRIENDSHIP
// TITLE: Access to private members from nested classes
// DESCRIPTION: If the compiler fails to support access to private members
// from nested classes
namespace boost_no_nested_friendship {
class A {
2010-10-01 09:19:44 +00:00
public:
A() {}
struct B {
int f(A& a)
{
a.f1();
a.f2(a);
return a.b;
}
};
2010-10-01 09:19:44 +00:00
private:
static int b;
static void f1(){}
template <class T>
static void f2(const T&){}
};
2010-10-01 09:19:44 +00:00
int A::b = 0;
int test()
{
2010-10-01 09:19:44 +00:00
A a;
A::B b;
return b.f(a);
}
}