1 // RUN: %clang_cc1 -O0 -finclude-default-header -fsyntax-only -triple dxil-pc-shadermodel6.6-library %s -verify
2 void unroll_no_vars() {
3 // expected-note@+1 {{declared here}}
5 // expected-error@+2 {{expression is not an integral constant expression}}
6 // expected-note@+1 {{read of non-const variable 'I' is not allowed in a constant expression}}
11 void unroll_arg_count() {
12 [unroll(2,4)] // expected-error {{'unroll' attribute takes no more than 1 argument}}
13 for(int i=0; i<100; i++);
16 void loop_arg_count() {
17 [loop(2)] // expected-error {{'loop' attribute takes no more than 0 argument}}
18 for(int i=0; i<100; i++);
21 void unroll_no_negative() {
22 [unroll(-1)] // expected-error {{invalid value '-1'; must be positive}}
23 for(int i=0; i<100; i++);
26 void unroll_no_zero() {
27 [unroll(0)] // expected-error {{invalid value '0'; must be positive}}
28 for(int i=0; i<100; i++);
31 void unroll_no_float() {
32 [unroll(2.1)] // expected-error {{invalid argument of type 'float'; expected an integer type}}
33 for(int i=0; i<100; i++);
36 void unroll_no_bool_false() {
37 [unroll(false)] // expected-error {{invalid argument of type 'bool'; expected an integer type}}
38 for(int i=0; i<100; i++);
41 void unroll_no_bool_true() {
42 [unroll(true)] // expected-error {{invalid argument of type 'bool'; expected an integer type}}
43 for(int i=0; i<100; i++);
46 void unroll_loop_enforcement() {
48 [unroll(4)] // expected-error {{'unroll' attribute only applies to 'for', 'while', and 'do' statements}}