mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 05:16:06 +00:00

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
18 lines
249 B
C++
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
|
|
}
|
|
};
|
|
}
|