diff options
author | dim <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
commit | 50b73317314e889cf39c7b1d6cbf419fa7502f22 (patch) | |
tree | be1815eb79b42ff482a8562b13c2dcbf0c5dcbee /test/Sema/conditional-expr.c | |
parent | dc04cb328508e61aad809d9b53b12f9799a00e7d (diff) | |
download | FreeBSD-src-50b73317314e889cf39c7b1d6cbf419fa7502f22.zip FreeBSD-src-50b73317314e889cf39c7b1d6cbf419fa7502f22.tar.gz |
Vendor import of clang trunk r154661:
http://llvm.org/svn/llvm-project/cfe/trunk@r154661
Diffstat (limited to 'test/Sema/conditional-expr.c')
-rw-r--r-- | test/Sema/conditional-expr.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c index 436ecdb..184ac4a 100644 --- a/test/Sema/conditional-expr.c +++ b/test/Sema/conditional-expr.c @@ -60,6 +60,23 @@ void foo() { test0 = test0 ? EVal : test1; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} test0 = test0 ? test1 : EVal; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + const int *const_int; + int *nonconst_int; + *(test0 ? const_int : nonconst_int) = 42; // expected-error {{read-only variable is not assignable}} + *(test0 ? nonconst_int : const_int) = 42; // expected-error {{read-only variable is not assignable}} + + // The composite type here should be "int (*)[12]", fine for the sizeof + int (*incomplete)[]; + int (*complete)[12]; + sizeof(*(test0 ? incomplete : complete)); // expected-warning {{expression result unused}} + sizeof(*(test0 ? complete : incomplete)); // expected-warning {{expression result unused}} + + int __attribute__((address_space(2))) *adr2; + int __attribute__((address_space(3))) *adr3; + test0 ? adr2 : adr3; // expected-warning {{pointer type mismatch}} expected-warning {{expression result unused}} + + // Make sure address-space mask ends up in the result type + (test0 ? (test0 ? adr2 : adr2) : nonconst_int); // expected-warning {{pointer type mismatch}} expected-warning {{expression result unused}} } int Postgresql() { |