This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/33483] New warning suggestion (for -Wall): sizeof() with non-lvalue has side effects that will not execute at runtime


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

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
It might makes sense to provide the functionality under the
-Wunevaluated-expression option for compatibility with clang:

$ cat u.c && clang -Wall -c u.c
int foo (int i)
{
    int a [i];
    return sizeof (a [i++]);
}
u.c:4:19: warning: expression with side effects has no effect in an unevaluated
      context [-Wunevaluated-expression]
    return sizeof (a [i++]);
                  ^
1 warning generated.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]