Vector.h produces a compiler warning when built with C++14 due to use of "if constexpr"
Author: mrkitaCreated Oct 23, 2025Updated Oct 23, 2025
When compiling with gcc on eastl 3.27.00, I run into a warning when "include/vector.h" is included in any compilation unit.
The warning states: eastl/include/EASTL/vector.h: In function 'void eastl::internal::AssertValueFitsInType(IntSourceType, const char*)': eastl/include/EASTL/vector.h:104:28: warning: 'if constexpr' only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
Given that the eastl vector is part of the code base not guarded with compiler traits, I would expect this code to compile without warning.
This warning disappears if "if constexpr" is replaced with the already existing compiler trait macro "EA_CONSTEXPR_IF".
Source: electronicarts/EASTL