diff options
Diffstat (limited to 'test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp')
-rw-r--r-- | test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp b/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp index 7cbc6ddf..2b7f9233 100644 --- a/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp +++ b/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp @@ -85,5 +85,32 @@ void okay() { auto diff = p - q; // OK, result is arithmetic - for(int ii : a) ; // OK, pointer arithmetic generated by compiler + for (int ii : a) + ; // OK, pointer arithmetic generated by compiler +} + +// Fix PR36207 +namespace std { +template <typename CharT> +struct char_traits {}; + +template <typename T> +struct allocator {}; + +template <typename CharT, + typename Traits = char_traits<CharT>, + typename Allocator = allocator<CharT>> +class basic_string {}; + +template <class CharT, class Traits, class Alloc> +basic_string<CharT, Traits, Alloc> operator+(const basic_string<CharT, Traits, Alloc> &lhs, + const CharT *rhs) {} + +using string = basic_string<char>; +} // namespace std + +std::string str_generated() {} + +void problematic_addition() { + std::string status = str_generated() + " is not found"; } |