https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88365
Bug ID: 88365 Summary: -Wsign-conversion ignores implicit conversion Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: igor.chorazewicz at intel dot com Target Milestone: --- Consider following code, compiled with -Wsign-conversion: #include <iostream> template <typename T> struct wrapper { T t; operator T() { return t; } T get() { return t; } }; int main() { int a[10]; int* x { a } ; wrapper<long unsigned int> y{2}; std::cout << (x + y); // warning } It produces "warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result". If y is of type "long unsigned int", there is no warning. Moreover when I explicitly call y.get() there is also no warning: std::cout << (x + y.get()); // ok