llvm-project/clang/test/SemaCXX/friend.cpp

18 lines
436 B
C++

// RUN: clang-cc -fsyntax-only -verify %s
friend class A; // expected-error {{'friend' used outside of class}}
void f() { friend class A; } // expected-error {{'friend' used outside of class}}
class C { friend class A; };
class D { void f() { friend class A; } }; // expected-error {{'friend' used outside of class}}
// PR5760
namespace test0 {
namespace ns {
void f(int);
}
struct A {
friend void ns::f(int a);
};
}