diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/cast.c | 6 | ||||
-rw-r--r-- | clang/test/Sema/static-init.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/test/Sema/cast.c b/clang/test/Sema/cast.c index 6ceec6923c8..ec19626d28e 100644 --- a/clang/test/Sema/cast.c +++ b/clang/test/Sema/cast.c @@ -5,4 +5,10 @@ cpumask_t x; void foo() { (void)x; } +void bar() { + char* a; + double b; + b = (double)a; // expected-error {{pointer cannot be cast to type}} + a = (char*)b; // expected-error {{cannot be cast to a pointer type}} +} diff --git a/clang/test/Sema/static-init.c b/clang/test/Sema/static-init.c index e6592f3bb65..99905f05574 100644 --- a/clang/test/Sema/static-init.c +++ b/clang/test/Sema/static-init.c @@ -5,7 +5,7 @@ static int f = 10; static int b = f; // expected-error {{initializer element is not a compile-time constant}} -float r = (float) &r; // expected-error {{initializer element is not a compile-time constant}} +float r = (float) (intptr_t) &r; // expected-error {{initializer element is not a compile-time constant}} intptr_t s = (intptr_t) &s; _Bool t = &t; |