This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/21755] New: Warning from function template in system header


Options: -Wall -isystem foo
-----
# 1 "foo.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "foo.cpp"
# 1 "foo/bar.h" 1 3 4
bool bar(int i, unsigned int u)
{
    return i < u;
}

template<typename T> bool baz(T i, unsigned int u)
{
    return i < u;
}
# 2 "foo.cpp" 2
void foo()
{
    bar(-3,5);
    baz(-3,5);
}
-----

The above results in:
foo/bar.h: In function `bool baz(T, unsigned int) [with T = int]':
foo.cpp:5:   instantiated from here
foo/bar.h:8: warning: comparison between signed and unsigned integer 
   expressions

(observed in 3.3, 3.4, 4.0). The warning should be suppressed, as foo/bar.h is
treated as a system header. It is correctly suppressed in the non-templated
function bar().

-- 
           Summary: Warning from function template in system header
           Product: gcc
           Version: 3.3.6
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: timb at bluearc dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21755


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]