Support float template params (#6801)

https://github.com/carbon-language/carbon-lang/issues/6717
This commit is contained in:
Nicholas Bishop
2026-02-27 01:30:40 +00:00
committed by GitHub
parent 41dd256d56
commit a6a0e55167
2 changed files with 42 additions and 23 deletions
@@ -3,6 +3,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/full.carbon
// EXTRA-ARGS: --clang-arg=-std=c++20
//
// AUTOUPDATE
// TIP: To test this file alone, run:
@@ -75,6 +76,16 @@ impl C as Core.ImplicitAs(i32) {
}
var s: Cpp.Simple({} as C) = Cpp.MakeSimple123();
// --- float.carbon
library "[[@TEST_NAME]]";
import Cpp inline '''
template<float N> struct Struct {};
Struct<123.5f> MakeStruct() { return Struct<123.5f>(); }
''';
let v: Cpp.Struct(123.5) = Cpp.MakeStruct();
// --- valid.carbon
library "[[@TEST_NAME]]";