mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:54:47 +01:00
Support floats in MapAPValueToConstant (#6800)
This allows `constexpr float` to be properly imported as a constant.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user