mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-16 12:18:11 +00:00
Export class friends to C++ (#8068)
This commit is contained in:
1 parent
5af3b7c47a
commit
66f03aecb1
2 files changed
+48
No files matched your search
@@ -106,3 +106,30 @@ void F() {
|
||||
b.F();
|
||||
}
|
||||
''';
|
||||
|
||||
// --- access_exported_private_member_of_friend.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
inline Cpp '''
|
||||
class C;
|
||||
''';
|
||||
|
||||
alias C = Cpp.C;
|
||||
|
||||
class A {}
|
||||
|
||||
class B {
|
||||
friend C;
|
||||
fn Make() -> Self { return {}; }
|
||||
private fn F() {}
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
class C {
|
||||
void G() {
|
||||
auto b = Carbon::B::Make();
|
||||
b.F();
|
||||
}
|
||||
};
|
||||
''';
|
||||
Reference in new issue
Block a user