https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103297
Bug ID: 103297
Summary: GCC cannot detect out of bounds in constexpr context.
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: unlvsur at live dot com
Target Milestone: ---
inline constexpr void out_of_bounds_detector(char const*,char const*) noexcept
{}
inline constexpr bool test() noexcept
{
char buffer[]="abcde";
out_of_bounds_detector(buffer,buffer+7);//should give a hard error
return true;
}
static_assert(test());
while clang and msvc can all detect this correctly.