1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s 2// expected-no-diagnostics 3 4 5_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(int), ""); 6_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(float), ""); 7_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(float4), ""); 8_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(double2), ""); 9 10// types must be complete 11_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(RWBuffer<int>), ""); 12_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(__hlsl_resource_t), ""); 13 14struct notComplete; 15_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(notComplete), ""); 16 17 18struct s { 19 int x; 20}; 21 22struct Empty {}; 23 24template<typename T> struct TemplatedBuffer { 25 T a; 26}; 27 28template<typename T> struct TemplatedVector { 29 vector<T, 4> v; 30}; 31 32// structs not allowed 33_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(s), ""); 34_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(Empty), ""); 35_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(TemplatedBuffer<int>), ""); 36_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(TemplatedVector<int>), ""); 37 38// arrays not allowed 39_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(half[4]), ""); 40 41typedef vector<int, 8> int8; 42// too many elements 43_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(int8), ""); 44 45typedef int MyInt; 46_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(MyInt), ""); 47 48// bool and enums not allowed 49_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(bool), ""); 50_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(vector<bool, 2>), ""); 51 52enum numbers { one, two, three }; 53 54_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(numbers), ""); 55 56// size exceeds 16 bytes, and exceeds element count limit after splitting 64 bit types into 32 bit types 57_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(double3), ""); 58 59