1- // RUN: %clang_cc1 -fsyntax-only -ffreestanding -verify %s
1+ // RUN: %dxc -Tlib_6_3 -HV 2018 -verify %s
2+ // RUN: %dxc -Tps_6_0 -HV 2018 -verify %s
23
34// This file provides test cases that are cross-references to the HLSL
45// specification.
@@ -78,7 +79,7 @@ namespace ns_basic {
7879//typedef int UNKA[]; // UNKA is an incomplete type ; fxc-error {{error X3072: array dimensions of type must be explicit}}
7980// cbuffer C; // fxc-error {{error X3000: syntax error: unexpected token ';'}}
8081
81- string s = "my string" ;
82+ string s = "my string" ; // expected-error {{string declaration may only appear in global scope}}
8283 int int_var;
8384 uint uint_var;
8485 dword dword_var;
@@ -151,7 +152,7 @@ namespace ns_std_conversions {
151152 fn_f4 (i); // vector splat
152153 fn_u4 (f4); // vector element
153154 fn_f4 (u4); // vector element
154- f3 = f4; // vector truncate
155+ f3 = f4; // expected-warning {{implicit truncation of vector type}}
155156 // f4 = f3; // fxc-error {{error X3017: cannot implicitly convert from 'float3' to 'float4'}}
156157 fn_iof (f1); // inout case (float1->float - vector single element conversion; float->float1 vector splat)
157158 fn_iof1 (u); // inout case (uint->float1 - vector splat; float1->uint vector single element conversion)
@@ -194,6 +195,7 @@ namespace ns_std_conversions {
194195 fn_f14 (1 );
195196
196197 u = f11; // matrix single element conversion
198+ // expected-warning@+1 {{implicit truncation of vector type}}
197199 u = f14; // matrix scalar truncation conversion
198200
199201 u2 = f11; // matrix single element vector conversion
@@ -202,8 +204,11 @@ namespace ns_std_conversions {
202204 //u3 = f12; // cannot convert if target has more
203205
204206 u44 = f44; // matrix element-type conversion
207+ // expected-warning@+1 {{implicit truncation of vector type}}
205208 u22 = f44; // can convert to smaller
209+ // expected-warning@+1 {{implicit truncation of vector type}}
206210 u22 = f33; // can convert to smaller
211+ // expected-warning@+1 {{implicit truncation of vector type}}
207212 f32 = f33; // can convert as long as each dimension is smaller
208213 //u44 = f22; // cannot convert to bigger
209214 }
@@ -307,14 +312,14 @@ namespace ns_std_conversions {
307312namespace ns_overloading {
308313// * Overloading
309314// ** Overloadable declarations
310- int f (int a) { return a; }
311- int f (const int a) { return a; }
315+ int f (int a) { return a; } // expected-note {{previous definition is here}}
316+ int f (const int a) { return a; } // expected-error {{redefinition of 'f'}}
312317 int f_default_0 (int a = 3 );
313318 //int f_default_0(int a = 4); // error X3114: 'a': default parameters can only be provided in the first prototype
314- int f_default (int a = 1 ) { return a; }
315- int f_default (int a = 3 ); // TODO: after definition, declaration may provide default, and this is ignored
319+ int f_default (int a = 1 ) { return a; } // expected-note {{previous definition is here}}
320+ int f_default (int a = 3 ); // expected-error {{redefinition of default argument}}
316321// int f_default_args(int a, int b = 0);
317- int f_default_args (int a = 0 , int b);
322+ int f_default_args (int a = 0 , int b); // expected-error {{missing default argument on parameter 'b'}}
318323 int f_default_args () { return 1 ; }
319324 int f_default_args_equiv (int a);
320325 int f_default_args_equiv (int a = 1 );
0 commit comments