vector-syntax_noerr.hlsl 726 B

1234567891011121314151617181920212223242526272829303132
  1. // RUN: %clang_cc1 -fsyntax-only -ffreestanding -verify %s
  2. // To test with the classic compiler, run
  3. // %sdxroot%\tools\x86\fxc.exe /T vs_5_1 vector-syntax.hlsl
  4. float fn() {
  5. float4 myvar = float4(1,2,3,4);
  6. myvar.x = 1.0f;
  7. myvar.y = 1.0f;
  8. myvar.z = 1.0f;
  9. myvar.w = 1.0f;
  10. float4 myothervar;
  11. myothervar.rgba = myvar.xyzw;
  12. float f;
  13. f.x = 1;
  14. uint u;
  15. u = f.x;
  16. uint3 u3;
  17. u3.xyz = f.xxx;
  18. //f.xx = 2; // expected-error {{vector is not assignable (contains duplicate components)}} fxc-error {{X3025: l-value specifies const object}}
  19. return f.x;
  20. }
  21. // float4 main(float4 param4 : FOO) : FOO {
  22. float4 plain(float4 param4 /* : FOO */) /*: FOO */{
  23. return fn();
  24. }