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

--- Comment #4 from Ivan Fefer <fefer.ivan at gmail dot com> ---
Sorry, hit the Submit button too early by accident.

Source code and compiler output are attached.

Bug is -Wsign-conversion warning triggerring:

bug.cpp:5:11: error: conversion to ‘long unsigned int’ from ‘int32_t {aka int}’
may change the sign of the result [-Werror=sign-conversion]
   r = r + static_cast<uint64_t>(q);
           ^~~~~~~~~~~~~~~~~~~~~~~~

in function 

void f(uint64_t a, int32_t q) {
  auto& r = a;
  r = r + static_cast<uint64_t>(q);
}

If we replace 'auto& r = a' with 'uint64_t& r = a' warning with disappear.

Reply via email to