mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Move and deduplicate testing access when a Carbon class extends a C++ record to access.carbon (#5897)
Followup of #5858. Part of #5859.
This commit is contained in:
@@ -211,36 +211,6 @@ fn MyF() {
|
||||
}
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// ============================================================================
|
||||
// To inherit private
|
||||
// ============================================================================
|
||||
|
||||
// --- to_inherit_private.h
|
||||
|
||||
class Bar {
|
||||
private:
|
||||
static auto foo() -> void;
|
||||
};
|
||||
|
||||
// --- fail_to_inherit_private.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "to_inherit_private.h";
|
||||
|
||||
class Derived {
|
||||
extend base: Cpp.Bar;
|
||||
}
|
||||
|
||||
fn MyF() {
|
||||
// CHECK:STDERR: fail_to_inherit_private.carbon:[[@LINE+5]]:3: error: cannot access private member `foo` of type `Cpp.Bar` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: Derived.foo();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_to_inherit_private.carbon: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR:
|
||||
Derived.foo();
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Template
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user