diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/const-ptr-int-ptr-cast.c | 4 | ||||
-rw-r--r-- | clang/test/Sema/static-init.c | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/clang/test/Sema/const-ptr-int-ptr-cast.c b/clang/test/Sema/const-ptr-int-ptr-cast.c index 6bf44b05b35..3590583cd5e 100644 --- a/clang/test/Sema/const-ptr-int-ptr-cast.c +++ b/clang/test/Sema/const-ptr-int-ptr-cast.c @@ -1,3 +1,5 @@ // RUN: clang -fsyntax-only -verify %s -char *a = (void*)(unsigned long long)(void*)&a; +#include <stdint.h> + +char *a = (void*)(uintptr_t)(void*)&a; diff --git a/clang/test/Sema/static-init.c b/clang/test/Sema/static-init.c index f7648a6d358..9ab3146ee76 100644 --- a/clang/test/Sema/static-init.c +++ b/clang/test/Sema/static-init.c @@ -1,9 +1,12 @@ // RUN: clang -arch i386 -fsyntax-only -verify %s + +#include <stdint.h> + static int f = 10; static int b = f; // expected-error {{initializer element is not a compile-time constant}} -float r = (float) &r; // FIXME: should give an error: ptr value used where a float was expected -long long s = (long long) &s; +float r = (float) &r; // expected-error {{initializer element is not a compile-time constant}} +intptr_t s = (intptr_t) &s; _Bool t = &t; @@ -16,5 +19,5 @@ struct foo { }; union bar u[1]; -struct foo x = {(long) u}; // no-error +struct foo x = {(intptr_t) u}; // no-error struct foo y = {(char) u}; // expected-error {{initializer element is not a compile-time constant}} |