]> granicus.if.org Git - clang/commitdiff
Fix test after -Wstring-plus-int warning was enabled
authorReid Kleckner <rnk@google.com>
Thu, 13 Dec 2018 21:24:08 +0000 (21:24 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 13 Dec 2018 21:24:08 +0000 (21:24 +0000)
Use array indexing instead of addition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349085 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaCXX/constant-expression-cxx1y.cpp

index 302b6ccb40e23733b370656b6566cf71bebbde75..a71dbc0eb501b1ac7c7e334b2aeee12da4ebb9ee 100644 (file)
@@ -444,7 +444,7 @@ namespace compound_assign {
   static_assert(test_bounds("foo", 0)[0] == 'f', "");
   static_assert(test_bounds("foo", 3)[0] == 0, "");
   static_assert(test_bounds("foo", 4)[-3] == 'o', "");
-  static_assert(test_bounds("foo" + 4, -4)[0] == 'f', "");
+  static_assert(test_bounds(&"foo"[4], -4)[0] == 'f', "");
   static_assert(test_bounds("foo", 5) != 0, ""); // expected-error {{constant}} expected-note {{call}}
   static_assert(test_bounds("foo", -1) != 0, ""); // expected-error {{constant}} expected-note {{call}}
   static_assert(test_bounds("foo", 1000) != 0, ""); // expected-error {{constant}} expected-note {{call}}