16e566bc5SRichard.. title:: clang-tidy - cppcoreguidelines-pro-bounds-constant-array-index
26e566bc5SRichard
36e566bc5SRichardcppcoreguidelines-pro-bounds-constant-array-index
46e566bc5SRichard=================================================
56e566bc5SRichard
66e566bc5SRichardThis check flags all array subscript expressions on static arrays and
76e566bc5SRichard``std::arrays`` that either do not have a constant integer expression index or
86e566bc5SRichardare out of bounds (for ``std::array``). For out-of-bounds checking of static
96e566bc5SRichardarrays, see the `-Warray-bounds` Clang diagnostic.
106e566bc5SRichard
11*0f1f1d45SPiotr ZegarThis rule is part of the `Bounds safety (Bounds 2)
12*0f1f1d45SPiotr Zegar<https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Pro-bounds-arrayindex>`_
13*0f1f1d45SPiotr Zegarprofile from the C++ Core Guidelines.
146e566bc5SRichard
156e566bc5SRichardOptionally, this check can generate fixes using ``gsl::at`` for indexing.
166e566bc5SRichard
176e566bc5SRichardOptions
186e566bc5SRichard-------
196e566bc5SRichard
206e566bc5SRichard.. option:: GslHeader
216e566bc5SRichard
226e566bc5SRichard   The check can generate fixes after this option has been set to the name of
236e566bc5SRichard   the include file that contains ``gsl::at()``, e.g. `"gsl/gsl.h"`.
246e566bc5SRichard
256e566bc5SRichard.. option:: IncludeStyle
266e566bc5SRichard
276e566bc5SRichard   A string specifying which include-style is used, `llvm` or `google`. Default
286e566bc5SRichard   is `llvm`.
29