summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/exprs.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-08 19:39:53 +0000
committerChris Lattner <sabre@nondot.org>2009-03-08 19:39:53 +0000
commit222b8bd6add9287f573522fc59bd6c099983550c (patch)
treed6fccc5b92e96c499744cab365b27e52a117118b /clang/test/Sema/exprs.c
parentbb1ba7b7d36e69fff74a7aae8182ca7c32ed14bc (diff)
downloadbcm5719-llvm-222b8bd6add9287f573522fc59bd6c099983550c.tar.gz
bcm5719-llvm-222b8bd6add9287f573522fc59bd6c099983550c.zip
implement PR3753, warning about comparisons with a string literal.
llvm-svn: 66387
Diffstat (limited to 'clang/test/Sema/exprs.c')
-rw-r--r--clang/test/Sema/exprs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c
index 45e146286a3..e307eb77584 100644
--- a/clang/test/Sema/exprs.c
+++ b/clang/test/Sema/exprs.c
@@ -72,7 +72,12 @@ void test10(int n,...) {
#define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
struct mystruct {int A; };
-void foo(struct mystruct P, float F) {
+void test11(struct mystruct P, float F) {
MYMAX(P, F); // expected-error {{invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))}}
}
+// PR3753
+int test12(const char *X) {
+ return X == "foo"; // expected-warning {{comparison against a string literal is undefined}}
+}
+
OpenPOWER on IntegriCloud