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: New warning suggestion (for -Wall): sizeof() with non-lvalue has side effects that will not execute at runtime


#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


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