-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
In the following program there are two similar signed integer overflows:
#include <cstdint>
void func(uint64_t) {}
struct A {
A(uint64_t){}
};
int main() {
func(1024 * 1024 * 1024 * 1024 * 1024ull); // warning, ok
A a(1024 * 1024 * 1024 * 1024 * 1024ull); // no warning in Clang!
}
The one in calling func
is detected by Clang.
But the other one in calling A::A
does not, even with -Wall -Wextra
flags. At the same time both GCC and MSVC reports the warning here as well. Online demo: https://gcc.godbolt.org/z/6vGT33q1W
Related discussion: https://stackoverflow.com/q/73962573/7325599
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