[Bug c++/33483] New: New warning suggestion (for -Wall): sizeof() with non-lvalue has side effects that will not execute at runtime
yuri at tsoft dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 18 22:50:00 GMT 2007
#include <iostream>
using namespace std;
Here is a very dangerous situation that compiler can catch illustrated by the
following example: when sizeof has non-lvalue argument.
--- example ---
int f() {
cout << "I am f" << endl;
return 5;
}
int main() {
cout << "sizeof=" << sizeof(f()) << endl; // HERE THE WARNING SHOULD BE
ISSUED
return (0);
}
--
Summary: New warning suggestion (for -Wall): sizeof() with non-
lvalue has side effects that will not execute at runtime
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yuri at tsoft dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33483
More information about the Gcc-bugs
mailing list