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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-01-03
                 CC|                            |manu at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org
            Summary|No -Wtype-limits warning    |[7/8/9 Regression] No
                   |when using templates        |-Wtype-limits warning when
                   |                            |using templates
     Ever confirmed|0                           |1
      Known to fail|                            |5.4.0, 6.3.0, 7.3.0, 8.2.0,
                   |                            |9.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
[Please include the full test case and GCC output in bug reports.]

Confirmed as a GCC 4.8 regression.  GCC 4.7 issues -Wtype-limits for templates.
 Bisection points to a revision in the range 124827 and 124899.  I don't have
GCC binaries for all the revisions in the range but the likely culprit seems to
be r124856.  I CC Manu for his thoughts.

2007-05-19  Manuel Lopez-Ibanez  <m...@gcc.gnu.org>

        * doc/invoke.texi (Warning Options): Add -Wconversion-sign.
        (Wconversion): Update description.
        (Wconversion-sign): New.
        * c.opt (Wconversion-sign): New.
        * c-opts.c (c_common_post_options): Uninitialized Wconversion-sign
        means disabled for C++. Otherwise, take the status of Wconversion.
        * c-common.c (conversion_warning): Warn with either Wconversion or
        Wconversion-sign.
        (warnings_for_convert_and_check): Conditions are already checked by
        conversion_warning.
        (convert_and_check): Don't check warnings if the conversion failed.

cp/
        * cvt.c (cp_convert_and_check): Don't check warnings if the
        conversion failed.

A simple test case and GCC output at r124825:

$ cat t.C && /opt/notnfs/gcc-bisect/obj/gcc/cc1plus.124825 -quiet -Wall -Werror
-o/dev/null t.C
template <typename T>
const char* f (T value)
{
  return value == 12345U ? "-1" : "no";
}

const char *s = f<unsigned char>(0);
cc1plus.124825: warnings being treated as errors
t.C: In function ‘const char* f(T) [with T = unsigned char]’:
t.C:7:   instantiated from here
t.C:4: error: comparison is always false due to limited range of data type

Reply via email to