cmake/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp

30 lines
243 B
C++
Raw Normal View History

2015-04-27 22:25:09 +02:00
template <typename T>
struct B
{
2016-07-09 11:21:54 +02:00
B()
: m_i(42)
{
}
2015-04-27 22:25:09 +02:00
private:
int m_i;
friend T;
};
struct A
{
2016-07-09 11:21:54 +02:00
template <typename T>
2015-04-27 22:25:09 +02:00
int getBValue(B<T> b)
{
return b.m_i;
}
};
void someFunc()
{
A a;
B<A> b;
a.getBValue(b);
}