40 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -std=hlsl202x -o - -fsyntax-only %s -verify2extern groupshared float f;3extern float groupshared f; // Ok, redeclaration?4 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}}8auto l = []() -> groupshared void {}; // #l9// 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}}12auto l2 = []() -> groupshared {}; // #l213 14float groupshared [[]] i = 12;15 16float groupshared const i2 = 12;17 18void foo() {19 l();20}21 22extern groupshared float f;23const float cf = 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}}26auto func() { // #func27 return f;28}29 30void other() {31 // NOTE: groupshared and const are stripped off thanks to lvalue to rvalue32 // 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; }; // #local36 // 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; }; // #local239}40