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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
      Known to work|                            |5.5.0
            Summary|-Wsign-conversion ignores   |[6/7/8/9
                   |explicit conversion in some |Regression]-Wsign-conversio
                   |cases                       |n ignores explicit
                   |                            |conversion in some cases
      Known to fail|                            |6.4.0, 7.3.0, 8.1.0, 9.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The manual does say that an explicit cast should silence the warning. This is a
regression since GCC 5, and only seems to happen when there's an indirection
through a typedef:

using size_t = unsigned long;

template<typename T> struct vector {
  using size_type = size_t;
  size_type size();
};

struct A
{
 int var;
 vector<int> vec;

 bool func()
 {
  return vec.size() < static_cast<size_t>(var);
 }
};

int main()
{
 A a;
 a.func();
}

Reply via email to