mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 11:50:27 +00: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 parent
d1b13194d5
commit
31919afa24
31 files changed
+986
-381
No files matched your search
@@ -1783,7 +1783,8 @@ static auto MakeConstantForBuiltinCall(EvalContext& eval_context,
|
||||
case SemIR::BuiltinFunctionKind::IntLeftShiftAssign:
|
||||
case SemIR::BuiltinFunctionKind::IntRightShiftAssign:
|
||||
case SemIR::BuiltinFunctionKind::PointerMakeNull:
|
||||
case SemIR::BuiltinFunctionKind::PointerIsNull: {
|
||||
case SemIR::BuiltinFunctionKind::PointerIsNull:
|
||||
case SemIR::BuiltinFunctionKind::PointerUnsafeConvert: {
|
||||
// These are runtime-only builtins.
|
||||
// TODO: Consider tracking this on the `BuiltinFunctionKind`.
|
||||
return SemIR::ConstantId::NotConstant;
|
||||
|
||||
Reference in new issue
Block a user