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

            Bug ID: 86190
           Summary: -Wsign-conversion ignores explicit conversion in some
                    cases
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: woodroof at gmail dot com
  Target Milestone: ---

Created attachment 44289
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44289&action=edit
Preprocessed source file

Affected versions:
g++ (Ubuntu 8-20180414-1ubuntu2) 8.0.1 20180414 (experimental) [trunk revision
259383]
g++-7 (Ubuntu 7.3.0-16ubuntu3) 7.3.0

Command line:
g++ -Wsign-conversion -c 1.cpp

Output:
1.cpp: In member function ‘bool A::func()’:
1.cpp:10:23: warning: conversion to ‘std::vector<int>::size_type’ {aka ‘long
unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
   return vec.size() < static_cast<size_t>(var);
                       ^~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to