| 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? |
| 4 |
|
| 5 |
// expected-error@+1 {{return type cannot be qualified with address space}} |
| 6 |
auto l = []() -> groupshared void {}; |
| 7 |
// expected-error@+1 {{expected a type}} |
| 8 |
auto l2 = []() -> groupshared {}; |
| 9 |
|
| 10 |
float groupshared [[]] i = 12; |
| 11 |
|
| 12 |
float groupshared const i2 = 12; |
| 13 |
|
| 14 |
void foo() { |
| 15 |
l(); |
| 16 |
} |
| 17 |
|
| 18 |
extern groupshared float f; |
| 19 |
const float cf = f; |
| 20 |
// expected-error@+1 {{'auto' return without trailing return type; deduced return types are a C++14 extension}} |
| 21 |
auto func() { |
| 22 |
return f; |
| 23 |
} |
| 24 |
|
| 25 |
void other() { |
| 26 |
// NOTE: groupshared and const are stripped off thanks to lvalue to rvalue conversions and we deduce float for the return type. |
| 27 |
auto l = [&]() { return f; }; |
| 28 |
auto l2 = [&]() { return cf; }; |
| 29 |
} |