From: Reid Kleckner Date: Thu, 13 Dec 2018 21:24:08 +0000 (+0000) Subject: Fix test after -Wstring-plus-int warning was enabled X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d196e59276bdb6fcb5cd1fd4232a68fb758f9f0;p=clang Fix test after -Wstring-plus-int warning was enabled Use array indexing instead of addition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349085 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaCXX/constant-expression-cxx1y.cpp b/test/SemaCXX/constant-expression-cxx1y.cpp index 302b6ccb40..a71dbc0eb5 100644 --- a/test/SemaCXX/constant-expression-cxx1y.cpp +++ b/test/SemaCXX/constant-expression-cxx1y.cpp @@ -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}}