This marks the `bit_cast` helper as `constexpr` and allows the casts implemented with it to also be `constexpr`. This is largely not a functional change, but it enables using the casts in expressions that need to be resolved at compile time as demonstrated with the static asserts in the new tests. --------- Co-authored-by: joaosaffran <126493771+joaosaffran@users.noreply.github.com>
11 lines
354 B
HLSL
11 lines
354 B
HLSL
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -verify
|
|
|
|
// expected-no-diagnostics
|
|
|
|
// Because asfloat should be constant evaluated, all the static asserts below
|
|
// should work!
|
|
void ConstExprTest() {
|
|
static_assert(asfloat(0x3f800000) == 1.0f, "One");
|
|
static_assert(asfloat(0x40000000.xxx).y == 2.0f, "Two");
|
|
}
|