Hal Finkel | f041733 | 2014-07-17 14:25:55 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-mingw32 -fms-extensions -fsyntax-only -verify %s |
Hal Finkel | bcc0608 | 2014-09-07 22:58:14 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s |
Hal Finkel | f041733 | 2014-07-17 14:25:55 +0000 | [diff] [blame] | 3 | |
| 4 | int foo(int *a, int i) { |
Hal Finkel | bcc0608 | 2014-09-07 22:58:14 +0000 | [diff] [blame] | 5 | #ifdef _MSC_VER |
Hal Finkel | f041733 | 2014-07-17 14:25:55 +0000 | [diff] [blame] | 6 | __assume(i != 4); |
Hal Finkel | bcc0608 | 2014-09-07 22:58:14 +0000 | [diff] [blame] | 7 | __assume(++i > 2); //expected-warning {{the argument to '__assume' has side effects that will be discarded}} |
Hal Finkel | a8443c3 | 2014-07-17 14:49:58 +0000 | [diff] [blame] | 8 | |
| 9 | int test = sizeof(struct{char qq[(__assume(i != 5), 7)];}); |
Hal Finkel | bcc0608 | 2014-09-07 22:58:14 +0000 | [diff] [blame] | 10 | #else |
| 11 | __builtin_assume(i != 4); |
| 12 | __builtin_assume(++i > 2); //expected-warning {{the argument to '__builtin_assume' has side effects that will be discarded}} |
Hal Finkel | a8443c3 | 2014-07-17 14:49:58 +0000 | [diff] [blame] | 13 | |
Hal Finkel | bcc0608 | 2014-09-07 22:58:14 +0000 | [diff] [blame] | 14 | int test = sizeof(struct{char qq[(__builtin_assume(i != 5), 7)];}); |
| 15 | #endif |
Hal Finkel | f041733 | 2014-07-17 14:25:55 +0000 | [diff] [blame] | 16 | return a[i]; |
| 17 | } |
| 18 | |