1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify 2 3// expected-note@+1 {{declared here}} 4cbuffer a { 5 int x; 6}; 7 8int foo() { 9 // expected-error@+1 {{'a' does not refer to a value}} 10 return sizeof(a); 11} 12 13// expected-error@+1 {{expected unqualified-id}} 14template <typename Ty> cbuffer a { Ty f; }; 15 16// For back-compat reason, it is OK for multiple cbuffer/tbuffer use same name in hlsl. 17// And these cbuffer name only used for reflection, cannot be removed. 18cbuffer A { 19 float A; 20} 21 22cbuffer A { 23 float b; 24} 25 26tbuffer A { 27 float a; 28} 29 30float bar() { 31 // cbuffer/tbuffer name will not conflict with other variables. 32 return A; 33} 34 35cbuffer a { 36 // expected-error@+2 {{unknown type name 'oh'}} 37 // expected-error@+1 {{expected ';' after top level declarator}} 38 oh no! 39 // expected-warning@+1 {{missing terminating ' character}} 40 this isn't even valid HLSL code 41 despite seeming totally reasonable 42 once you understand that HLSL 43 is so flaming weird. 44} 45 46tbuffer B { 47 // expected-error@+1 {{unknown type name 'flaot'}} 48 flaot f; 49} 50