https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87413

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |msebor at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=80265

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
As Jonathan already mentioned, treating __builtin_strlen("string") (among other
string function calls) as a constant integer expression is a useful extension
accepted by several C++ compilers, including Clang and ICC 18 (see also
pr80265).

G++ accepts the test case in C++ 11 mode and later, but rejects it with an
error in C++ 98 mode.  Since C++ requires array bounds to be constant
expressions and calls to functions are not such expressions, it might be worth
issuing a pedantic warning on the strlen case in C++ 11 mode and later.

Reply via email to