We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c64b3f6 commit 61da5e6Copy full SHA for 61da5e6
src/parser/cxx/parser.cc
@@ -43,6 +43,7 @@
43
#include <cstring>
44
#include <format>
45
#include <iostream>
46
+#include <limits>
47
#include <ranges>
48
#include <unordered_set>
49
@@ -483,8 +484,12 @@ auto Parser::parse_literal(ExpressionAST*& yyast) -> bool {
483
484
ast->type = control_->getLongIntType();
485
else if (components.isUnsigned)
486
ast->type = control_->getUnsignedIntType();
- else
487
- ast->type = control_->getIntType();
+ else {
488
+ if (ast->literal->integerValue() > std::numeric_limits<int>::max())
489
+ ast->type = control_->getLongIntType();
490
+ else
491
+ ast->type = control_->getIntType();
492
+ }
493
494
return true;
495
}
0 commit comments