summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Sema/warn-unsequenced.c7
-rw-r--r--test/SemaCXX/warn-unsequenced.cpp4
2 files changed, 9 insertions, 2 deletions
diff --git a/test/Sema/warn-unsequenced.c b/test/Sema/warn-unsequenced.c
index 247a121941..9654cda924 100644
--- a/test/Sema/warn-unsequenced.c
+++ b/test/Sema/warn-unsequenced.c
@@ -95,4 +95,11 @@ void test() {
_Alignof(++a) + ++a; // expected-warning {{extension}}
__builtin_constant_p(f(++a, 0)) ? f(f(++a, 0), f(++a, 0)) : 0;
+
+ if (0) ++a + ++a; // ok, unreachable
+}
+
+void g(const char *p, int n) {
+ // This resembles code produced by some macros in glibc's <string.h>.
+ __builtin_constant_p(p) && __builtin_constant_p(++n) && (++n + ++n);
}
diff --git a/test/SemaCXX/warn-unsequenced.cpp b/test/SemaCXX/warn-unsequenced.cpp
index 1dd2f6d74d..bb8fd8be3d 100644
--- a/test/SemaCXX/warn-unsequenced.cpp
+++ b/test/SemaCXX/warn-unsequenced.cpp
@@ -486,8 +486,8 @@ int Foo<X>::Run() {
// cxx17-warning@-2 {{unsequenced modification and access to 'num'}}
foo(num++, num++);
- // cxx11-warning@-1 2{{multiple unsequenced modifications to 'num'}}
- // cxx17-warning@-2 2{{multiple unsequenced modifications to 'num'}}
+ // cxx11-warning@-1 {{multiple unsequenced modifications to 'num'}}
+ // cxx17-warning@-2 {{multiple unsequenced modifications to 'num'}}
return 1;
}