1 // RUN: %clang_cc1 -triple i386-mingw32 -fms-extensions -fsyntax-only -verify %s 2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s 3 4 int nonconst(void); 5 int isconst(void) __attribute__((const)); 6 int ispure(int) __attribute__((pure)); 7 foo(int * a,int i)8int foo(int *a, int i) { 9 #ifdef _MSC_VER 10 __assume(i != 4); 11 __assume(++i > 2); //expected-warning {{the argument to '__assume' has side effects that will be discarded}} 12 __assume(nonconst() > 2); //expected-warning {{the argument to '__assume' has side effects that will be discarded}} 13 __assume(isconst() > 2); 14 __assume(ispure(i) > 2); 15 __assume(ispure(++i) > 2); //expected-warning {{the argument to '__assume' has side effects that will be discarded}} 16 17 int test = sizeof(struct{char qq[(__assume(i != 5), 7)];}); 18 #else 19 __builtin_assume(i != 4); 20 __builtin_assume(++i > 2); //expected-warning {{the argument to '__builtin_assume' has side effects that will be discarded}} 21 __builtin_assume(nonconst() > 2); //expected-warning {{the argument to '__builtin_assume' has side effects that will be discarded}} 22 __builtin_assume(isconst() > 2); 23 __builtin_assume(ispure(i) > 2); 24 __builtin_assume(ispure(++i) > 2); //expected-warning {{the argument to '__builtin_assume' has side effects that will be discarded}} 25 26 int test = sizeof(struct{char qq[(__builtin_assume(i != 5), 7)];}); 27 #endif 28 return a[i]; 29 } 30 31