-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
a279a09
commit c1401e9
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// 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 | ||
} | ||
}; | ||
} |