llvm-project/clang/test/Sema/local-class-friend.cpp
Elizabeth Andrews c1401e9f3e [Clang][Sema] Fix access of friend class in local class
Clang currently emits an error when a friend of a local class
tries to access it's private data members. This patch fixes the bug.

Differential Revision: https://reviews.llvm.org/D152195
2023-06-06 10:46:50 -07:00

18 lines
249 B
C++

// RUN: %clang_cc1 -verify -fsyntax-only %s
// expected-no-diagnostics
void foo()
{ class c1 {
private:
int testVar;
public:
friend class c2;
};
class c2 {
void f(c1 obj) {
int a = obj.testVar; // Ok
}
};
}