mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:54:49 +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:
@@ -505,6 +505,11 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id,
|
||||
context.GetValue(arg_ids[0])));
|
||||
return;
|
||||
}
|
||||
|
||||
case SemIR::BuiltinFunctionKind::PointerUnsafeConvert: {
|
||||
context.SetLocal(inst_id, context.GetValue(arg_ids[0]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CARBON_FATAL("Unsupported builtin call.");
|
||||
|
||||
Reference in New Issue
Block a user