summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/static-init.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-05-30 18:14:48 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-05-30 18:14:48 +0000
commit66572afde48b08fc3c9cc2722ee8457e9ebc98e3 (patch)
tree5ced1479c5b408d11e43cf7ffeb99f39b8e8c12f /clang/test/Sema/static-init.c
parent3360d898ec6b7694a7c885abfbcbb00e576810b3 (diff)
downloadbcm5719-llvm-66572afde48b08fc3c9cc2722ee8457e9ebc98e3.tar.gz
bcm5719-llvm-66572afde48b08fc3c9cc2722ee8457e9ebc98e3.zip
Allow a pointer implicitly cast to a bool as a constant expression, as
required by the standard (the standard doesn't know anything about implicit casts). Disallow pointers cast to non-integral arithmetic types as constant expressions. This was previously allowed by accident. llvm-svn: 51779
Diffstat (limited to 'clang/test/Sema/static-init.c')
-rw-r--r--clang/test/Sema/static-init.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/Sema/static-init.c b/clang/test/Sema/static-init.c
index e710973700a..2439d5e714e 100644
--- a/clang/test/Sema/static-init.c
+++ b/clang/test/Sema/static-init.c
@@ -1,3 +1,7 @@
// RUN: clang -fsyntax-only -verify %s
static int f = 10;
static int b = f; // expected-error {{initializer element is not constant}}
+
+float r = (float) &r; // expected-error {{initializer element is not constant}}
+long long s = (long long) &s;
+_Bool t = &t;
OpenPOWER on IntegriCloud