r349085 - Fix test after -Wstring-plus-int warning was enabled

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 13 13:24:08 PST 2018


Author: rnk
Date: Thu Dec 13 13:24:08 2018
New Revision: 349085

URL: http://llvm.org/viewvc/llvm-project?rev=349085&view=rev
Log:
Fix test after -Wstring-plus-int warning was enabled

Use array indexing instead of addition.

Modified:
    cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp

Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp?rev=349085&r1=349084&r2=349085&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp (original)
+++ cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp Thu Dec 13 13:24:08 2018
@@ -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}}




More information about the cfe-commits mailing list