1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -std=hlsl202x -o - -fsyntax-only %s -verify
2 extern groupshared float f;
3 extern float groupshared f; // Ok, redeclaration?
5 // expected-error@#l {{return type cannot be qualified with address space}}
6 // expected-warning@#l {{lambdas are a clang HLSL extension}}
7 // expected-warning@#l{{'auto' type specifier is a HLSL 202y extension}}
8 auto l = []() -> groupshared void {}; // #l
9 // expected-error@#l2 {{expected a type}}
10 // expected-warning@#l2 {{lambdas are a clang HLSL extension}}
11 // expected-warning@#l2{{'auto' type specifier is a HLSL 202y extension}}
12 auto l2 = []() -> groupshared {}; // #l2
14 float groupshared [[]] i = 12;
16 float groupshared const i2 = 12;
22 extern groupshared float f;
24 // expected-error@#func{{'auto' return without trailing return type; deduced return types are a C++14 extension}}
25 // expected-warning@#func{{'auto' type specifier is a HLSL 202y extension}}
26 auto func() { // #func
31 // NOTE: groupshared and const are stripped off thanks to lvalue to rvalue
32 // conversions and we deduce float for the return type.
33 // expected-warning@#local{{lambdas are a clang HLSL extension}}
34 // expected-warning@#local{{'auto' type specifier is a HLSL 202y extension}}
35 auto l = [&]() { return f; }; // #local
36 // expected-warning@#local2{{lambdas are a clang HLSL extension}}
37 // expected-warning@#local2{{'auto' type specifier is a HLSL 202y extension}}
38 auto l2 = [&]() { return cf; }; // #local2