1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify
3 // expected-error@+1 {{invalid resource class specifier 'c' used; expected 'b', 's', 't', or 'u'}}
4 float a : register(c0, space1);
6 // expected-error@+1 {{invalid resource class specifier 'i' used; expected 'b', 's', 't', or 'u'}}
7 cbuffer b : register(i0) {
10 // expected-error@+1 {{invalid space specifier 's2' used; expected 'space' followed by an integer, like space1}}
11 cbuffer c : register(b0, s2) {
14 // expected-error@+1 {{register number should be an integer}}
15 cbuffer d : register(bf, s2) {
18 // expected-error@+1 {{invalid space specifier 'spaces' used; expected 'space' followed by an integer, like space1}}
19 cbuffer e : register(b2, spaces) {
23 // expected-error@+1 {{expected identifier}}
24 cbuffer A : register() {}
26 // expected-error@+1 {{register number should be an integer}}
27 cbuffer B : register(space1) {}
29 // expected-error@+1 {{wrong argument format for hlsl attribute, use b2 instead}}
30 cbuffer C : register(b 2) {}
32 // expected-error@+2 {{wrong argument format for hlsl attribute, use b2 instead}}
33 // expected-error@+1 {{wrong argument format for hlsl attribute, use space3 instead}}
34 cbuffer D : register(b 2, space 3) {}
36 // expected-warning@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
37 static RWBuffer<float> U : register(u5);
40 // expected-warning@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
41 RWBuffer<float> U : register(u3);
44 // expected-warning@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
45 extern RWBuffer<float> U2 : register(u5);
47 // FIXME: expect-error once fix https://github.com/llvm/llvm-project/issues/57886.
48 float b : register(u0, space1);
50 // expected-warning@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}}
51 void bar(RWBuffer<float> U : register(u3)) {
56 // FIXME: generate better error when support semantic on struct field.
57 // See https://github.com/llvm/llvm-project/issues/57889.
58 // expected-error@+1 {{expected expression}}
59 RWBuffer<float> U : register(u3);