Skip to content

Commit 57b5483

Browse files
committed
add sema tests
1 parent ce43937 commit 57b5483

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ bool SemaHLSL::diagnosePositionType(QualType T, const ParsedAttr &AL) {
11591159

11601160
if (!T->hasFloatingRepresentation() || (VT && VT->getNumElements() > 4)) {
11611161
Diag(AL.getLoc(), diag::err_hlsl_attr_invalid_type)
1162-
<< AL << "float/float1/float2/float3";
1162+
<< AL << "float/float1/float2/float3/float4";
11631163
return false;
11641164
}
11651165

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -finclude-default-header -o - %s -verify -verify-ignore-unexpected
2+
// RUN: %clang_cc1 -triple spirv-unknown-vulkan1.3-library -x hlsl -finclude-default-header -o - %s -verify -verify-ignore-unexpected
3+
4+
// expected-error@+1 {{attribute 'SV_Position' only applies to a field or parameter of type 'float/float1/float2/float3/float4'}}
5+
void main(vector<float, 5> a : SV_Position) {
6+
}
7+
8+
// expected-error@+1 {{attribute 'SV_Position' only applies to a field or parameter of type 'float/float1/float2/float3/float4'}}
9+
void main(int2 a : SV_Position) {
10+
}

0 commit comments

Comments
 (0)