mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 18:31:08 +01:00
Allow conversion between T* and Cpp.void*. (#6575)
Support an implicit conversion from `T*` to `Cpp.void*` and to `const Cpp.void*`, and an `unsafe as` conversion in the opposite direction. In order to support C++ calls taking and returning `void*` (which get mapped to Carbon `Optional(Cpp.void*)`, also support conversions from `Optional(T)` to `Optional(U)` if there's a conversion from `T` to `U`. Fix a bug in `OptionalStorage` for `T*` where its `HasValue` was exactly backwards.
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ fn G() {
|
||||
// CHECK:STDERR: fail_void_abstract.carbon:[[@LINE+7]]:10: error: binding pattern has abstract type `Cpp.void` in `var` pattern [AbstractTypeInVarPattern]
|
||||
// CHECK:STDERR: var x: Cpp.void;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: {{.*}}/prelude/types/cpp/void.carbon:22:1: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: {{.*}}/prelude/types/cpp/void.carbon:24:1: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: abstract class CppCompat.VoidBase {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
|
||||
Reference in New Issue
Block a user