http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59248

            Bug ID: 59248
           Summary: [4.8 regression] pointless -Wconversion warning with
                    sizeof, take 2
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.maurer at gmx dot net

The simple case was fixed with
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56930 (thanks, Jason), but a
slightly more involved case still warns spuriously:

$ g++ -Wconversion -std=c++11 x.cc 
x.cc: In function ‘int main()’:
x.cc:3:12: warning: conversion to ‘int’ from ‘long unsigned int’ may alter its
value [-Wconversion]
   int x = 2*sizeof(int);
            ^
x.cc:4:12: warning: conversion to ‘int’ from ‘long unsigned int’ may alter its
value [-Wconversion]
   int y { 2* sizeof(int) };
            ^

This didn't produce any warnings with gcc 4.7.3.

Reply via email to