aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c
new file mode 100644
index 000000000..f2a711aeb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c
@@ -0,0 +1,29 @@
+/* PR c/7776 */
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wno-address" } */
+
+int test1(char *ptr)
+{
+ return ptr == "foo";
+}
+
+int test2()
+{
+ return "foo" != (const char*)0;
+}
+
+int test3()
+{
+ return "foo" == (const char*)0;
+}
+
+int test4()
+{
+ return (const char*)0 != "foo";
+}
+
+int test5()
+{
+ return (const char*)0 == "foo";
+}
+