| 1 |
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -fsyntax-only -verify %s |
| 2 |
|
| 3 |
// Some bad declarations |
| 4 |
hlsl::vector ShouldWorkSomeday; // expected-error{{use of alias template 'hlsl::vector' requires template arguments}} |
| 5 |
// expected-note@*:* {{template declaration from hidden source: template <class element = float, int element_count = 4> using vector = vector<element, element_count>}} |
| 6 |
|
| 7 |
hlsl::vector<1> BadVec; // expected-error{{template argument for template type parameter must be a type}} |
| 8 |
// expected-note@*:* {{template parameter from hidden source: class element = float}} |
| 9 |
|
| 10 |
hlsl::vector<int, float> AnotherBadVec; // expected-error{{template argument for non-type template parameter must be an expression}} |
| 11 |
// expected-note@*:* {{template parameter from hidden source: int element_count = 4}} |
| 12 |
|
| 13 |
hlsl::vector<int, 2, 3> YABV; // expected-error{{too many template arguments for alias template 'vector'}} |
| 14 |
// expected-note@*:* {{template declaration from hidden source: template <class element = float, int element_count = 4> using vector = vector<element, element_count>}} |
| 15 |
|
| 16 |
// This code is rejected by clang because clang puts the HLSL built-in types |
| 17 |
// into the HLSL namespace. |
| 18 |
namespace hlsl { |
| 19 |
struct vector {}; // expected-error {{redefinition of 'vector'}} |
| 20 |
} |
| 21 |
|
| 22 |
// This code is rejected by dxc because dxc puts the HLSL built-in types |
| 23 |
// into the global space, but clang will allow it even though it will shadow the |
| 24 |
// vector template. |
| 25 |
struct vector {}; // expected-note {{candidate found by name lookup is 'vector'}} |
| 26 |
|
| 27 |
vector<int,2> VecInt2; // expected-error {{reference to 'vector' is ambiguous}} |
| 28 |
|
| 29 |
// expected-note@*:* {{candidate found by name lookup is 'hlsl::vector'}} |