https://bugs.llvm.org/show_bug.cgi?id=42090

            Bug ID: 42090
           Summary: Missed -Wsign-compare as compared to GCC9
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Manually reduced:

#include <cstdint>

struct S {
  int a;

  constexpr S();
  explicit constexpr S(int a_) : a(a_) {}
};

constexpr S b = S(12);

template <const S& e>
bool c(unsigned int d) {
  return d >= e.a;
}

bool test(unsigned int d);
bool test(unsigned int d) {
    return c<b>(d);
}

GCC diagnoses:
<source>: In instantiation of 'bool c(unsigned int) [with const S& e = b]':
<source>:19:18:   required from here
<source>:14:12: warning: comparison of integer expressions of different
signedness: 'unsigned int' and 'const int' [-Wsign-compare]
   14 |   return d >= e.a;
      |          ~~^~~~~~
Compiler returned: 0

clang doesn't.
https://godbolt.org/z/7xrWzz

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to