-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party
Description
compiler explorer link: https://godbolt.org/z/Wd318Mdrx
typedef long long int64_t;
template<typename T>
class u_ptr {
T *ptr;
public:
u_ptr(const u_ptr&) = delete;
u_ptr &operator=(const u_ptr&) = delete;
u_ptr(u_ptr &&other) : ptr(other.ptr) { other.ptr = 0; }
u_ptr(T *ptr) : ptr(ptr) { }
~u_ptr() { delete ptr; }
};
u_ptr<bool> Wrap(int64_t x) {
return nullptr;
}
int64_t Pass(int64_t x) { return x; }
int main(int argc, char* argv[]) {
// This trips -Winteger-overflow:
int64_t x = Pass(30 * 24 * 60 * 59 * 1000);
// This doesn't trip -Winteger-overflow.
auto r = Wrap(Pass(30 * 24 * 60 * 59 * 1000));
return 0;
}
Patch coming shortly.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party