summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
index ce192805dda..22d98bcd121 100644
--- a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
+++ b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
@@ -1,4 +1,5 @@
// RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-array-to-pointer-decay %t
+#include <assert.h>
#include <stddef.h>
namespace gsl {
@@ -34,6 +35,11 @@ void f() {
for (auto &e : a) // OK, iteration internally decays array to pointer
e = 1;
+
+ assert(false); // OK, array decay inside system header macro
+
+ assert(a);
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
}
const char *g() {
OpenPOWER on IntegriCloud