-
Notifications
You must be signed in to change notification settings - Fork 15k
Open
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 analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featurequality-of-implementation
Description
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
if (argc < 2)
return 0;
long long x = strtoll(argv[1], NULL, 10);
if (x >= 0 && x <= INT_MAX) {
int y = x;
printf("%d\n", y);
}
return 0;
}Compiling with clang-19 -Wshorten-64-to-32 produces this warning on the int y = x; line:
warning: implicit conversion loses integer precision: 'long long' to 'int' [-Wshorten-64-to-32]
Expected result: No warning.
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 analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featurequality-of-implementation