mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 06:41:04 +01:00
Allow interop with classes with virtual base classes. (#6413)
For now, treat such classes as being final, since we can't correctly derive from them. This removes the last category of C++ class that we are entirely unable to interop with, and is a prerequisite for interop with C++ iostreams (which have a virtual base class).
This commit is contained in:
@@ -877,54 +877,6 @@ fn F() {
|
||||
let result: i32 = *CreateIncomplete() + complete;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Unsupported operand type in instantiation
|
||||
// ============================================================================
|
||||
|
||||
// --- unsupported_in_instantiation.h
|
||||
|
||||
struct Supported {};
|
||||
|
||||
template<typename T>
|
||||
struct Unsupported : public virtual Supported {};
|
||||
using UnsupportedAlias = Unsupported<int>;
|
||||
extern UnsupportedAlias unsupported;
|
||||
|
||||
// --- fail_import_unsupported_in_instantiation_unary.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "unsupported_in_instantiation.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_unsupported_in_instantiation_unary.carbon:[[@LINE+7]]:21: error: semantics TODO: `class with virtual bases` [SemanticsTodo]
|
||||
// CHECK:STDERR: let result: i32 = -Cpp.unsupported;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_unsupported_in_instantiation_unary.carbon:[[@LINE+4]]:21: note: while completing C++ type `Cpp.Unsupported` [InCppTypeCompletion]
|
||||
// CHECK:STDERR: let result: i32 = -Cpp.unsupported;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let result: i32 = -Cpp.unsupported;
|
||||
}
|
||||
|
||||
// --- fail_import_unsupported_in_instantiation_binary.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "unsupported_in_instantiation.h";
|
||||
|
||||
fn F() {
|
||||
var supported: Cpp.Supported = Cpp.Supported.Supported();
|
||||
// CHECK:STDERR: fail_import_unsupported_in_instantiation_binary.carbon:[[@LINE+7]]:21: error: semantics TODO: `class with virtual bases` [SemanticsTodo]
|
||||
// CHECK:STDERR: let result: i32 = supported + Cpp.unsupported;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_unsupported_in_instantiation_binary.carbon:[[@LINE+4]]:21: note: while completing C++ type `Cpp.Unsupported` [InCppTypeCompletion]
|
||||
// CHECK:STDERR: let result: i32 = supported + Cpp.unsupported;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let result: i32 = supported + Cpp.unsupported;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Indirect template instantiation
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user