编译如下:
void bar() { /* ... */ }
void foo()
{
struct MyStruct
{
friend void bar();
};
}
int main()
{
//..
}
导致错误:
错误:没有事先声明的本地类中的友元声明“void bar()”
为什么名称查找失败?我该如何解决?
编译如下:
void bar() { /* ... */ }
void foo()
{
struct MyStruct
{
friend void bar();
};
}
int main()
{
//..
}
导致错误:
错误:没有事先声明的本地类中的友元声明“void bar()”
为什么名称查找失败?我该如何解决?