Files
clang-p2996/clang/test/SemaHLSL/group_shared_202x.hlsl
Chris B 2222e27d9e [HLSL] Add HLSL 202y language mode (#108437)
This change adds a new HLSL 202y language mode. Currently HLSL 202y is
planned to add `auto` and `constexpr`.

This change updates extension diagnostics to state that lambadas are a
"clang HLSL" extension (since we have no planned release yet to include
them), and that `auto` is a HLSL 202y extension when used in earlier
language modes.

Note: This PR does temporarily work around some differences between HLSL
2021 and 202x in Clang by changing test cases to explicitly specify
202x. A subsequent PR will update 2021's language flags to match 202x.
2024-09-13 16:11:19 -05:00

31 lines
1.3 KiB
HLSL

// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -std=hlsl202x -o - -fsyntax-only %s -verify
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -std=hlsl202y -o - -fsyntax-only %s -verify
#if __HLSL_VERSION < 2029
// expected-warning@#func{{'auto' type specifier is a HLSL 202y extension}}
// expected-warning@#func_gs{{'auto' type specifier is a HLSL 202y extension}}
// expected-warning@#l{{'auto' type specifier is a HLSL 202y extension}}
// expected-warning@#l2{{'auto' type specifier is a HLSL 202y extension}}
#endif
// expected-error@#func {{return type cannot be qualified with address space}}
auto func() -> groupshared void; // #func
// expected-error@#func_gs {{parameter may not be qualified with an address space}}
auto func(float groupshared) -> void; // #func_gs
// expected-error@#l {{parameter may not be qualified with an address space}}
// expected-warning@#l {{lambdas are a clang HLSL extension}}
auto l = [](groupshared float ) {}; // #l
// expected-error@#l2 {{return type cannot be qualified with address space}}
// expected-warning@#l2 {{lambdas are a clang HLSL extension}}
auto l2 = []() -> groupshared void {}; // #l2
struct S {
// expected-error@+1 {{return type cannot be qualified with address space}}
operator groupshared int() const;
};