Support floats in MapAPValueToConstant (#6800)

This allows `constexpr float` to be properly imported as a constant.
This commit is contained in:
Nicholas Bishop
2026-02-26 19:48:19 +00:00
committed by GitHub
parent d11ee4b2b1
commit 96f163f114
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -33,3 +33,15 @@ constexpr int i = 123;
class C(I:! i32) {}
fn F() -> C(Cpp.i);
let x: C(123) = F();
// --- float.carbon
library "[[@TEST_NAME]]";
import Cpp inline '''
constexpr float flt = 123.5;
''';
class C(V:! f32) {}
fn F() -> C(Cpp.flt);
let x: C(123.5) = F();