Skip to content

[MPL] Fixed a compilation warning

wenqing requested to merge wenqing/ogs:fix_warning into master

The warning is

 58 |     variable_enum_to_string{{"capillary_pressure",
      |     ^~~~~~~~~~~~~~~~~~~~~~~
In static member function ‘static constexpr _Tp& std::__array_traits<_Tp, _Nm>::_S_ref(const _Tp (&)[_Nm], std::size_t) [with _Tp = std::__cxx11::basic_string<char>; long unsigned int _Nm = 23]’,
    inlined from ‘constexpr const std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](size_type) const [with _Tp = std::__cxx11::basic_string<char>; long unsigned int _Nm = 23]’ at /usr/include/c++/12.2.0/array:219:25,
    inlined from ‘MaterialPropertyLib::VariableType MaterialPropertyLib::VariableArray::operator[](MaterialPropertyLib::Variable) const’ at /home/wenqing/Code/ogs6/sources/MaterialLib/MPL/VariableType.h:146:17:
/usr/include/c++/12.2.0/array:61:36: warning: array subscript 23 is above array bounds of ‘std::__array_traits<std::__cxx11::basic_string<char>, 23>::_Type’ {aka ‘const std::__cxx11::basic_string<char> [23]’} [-Warray-bounds]
  1. Feature description was added to the changelog
  2. Tests covering your feature were added?
  3. Any new feature or behavior change was documented?

Merge request reports