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

            Bug ID: 93589
           Summary: Template instantiation creates a conversion warning
                    when it should not
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lokeshjanghel91 at gmail dot com
  Target Milestone: ---

Created attachment 47780
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47780&action=edit
Run the attached file with -Wconversion

When compiling the attached file, a conversion warning is given if the compiler
is GCC.  This does not happen with CLANG.

$ g++ -Wconversion example.cpp
example.cpp: In instantiation of ‘void print_byte_order(T) [with T = short
int]’:
example.cpp:12:27:   required from here
example.cpp:7:5: warning: conversion to ‘short int’ from ‘int’ may alter its
value [-Wconversion]
 val |=( 5 * static_cast<T>(i));
     ^

Reply via email to