Skip to content

Commit c00c901

Browse files
authored
[clang] Use separator for large numeric values in overflow diagnostic (#80939)
Add functionality to APInt::toString() that allows it to insert separators between groups of digits, using the C++ literal separator ' between groups. Fixes issue #58228 Reviewers: @AaronBallman, @cjdb, @tbaederr
1 parent 341d674 commit c00c901

File tree

16 files changed

+195
-126
lines changed

16 files changed

+195
-126
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ Improvements to Clang's diagnostics
177177
- The ``-Wshorten-64-to-32`` diagnostic is now grouped under ``-Wimplicit-int-conversion`` instead
178178
of ``-Wconversion``. Fixes #GH69444.
179179

180+
- Clang now uses thousand separators when printing large numbers in integer overflow diagnostics.
181+
Fixes #GH80939.
182+
180183
- Clang now diagnoses friend declarations with an ``enum`` elaborated-type-specifier in language modes after C++98.
181184

182185
- Added diagnostics for C11 keywords being incompatible with language standards

clang/lib/AST/ExprConstant.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,7 +2778,9 @@ static bool CheckedIntArithmetic(EvalInfo &Info, const Expr *E,
27782778
if (Info.checkingForUndefinedBehavior())
27792779
Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
27802780
diag::warn_integer_constant_overflow)
2781-
<< toString(Result, 10) << E->getType() << E->getSourceRange();
2781+
<< toString(Result, 10, Result.isSigned(), /*formatAsCLiteral=*/false,
2782+
/*UpperCase=*/true, /*InsertSeparators=*/true)
2783+
<< E->getType() << E->getSourceRange();
27822784
return HandleOverflow(Info, E, Value, E->getType());
27832785
}
27842786
return true;
@@ -13910,7 +13912,9 @@ bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
1391013912
if (Info.checkingForUndefinedBehavior())
1391113913
Info.Ctx.getDiagnostics().Report(E->getExprLoc(),
1391213914
diag::warn_integer_constant_overflow)
13913-
<< toString(Value, 10) << E->getType() << E->getSourceRange();
13915+
<< toString(Value, 10, Value.isSigned(), /*formatAsCLiteral=*/false,
13916+
/*UpperCase=*/true, /*InsertSeparators=*/true)
13917+
<< E->getType() << E->getSourceRange();
1391413918

1391513919
if (!HandleOverflow(Info, E, -Value.extend(Value.getBitWidth() + 1),
1391613920
E->getType()))

clang/lib/AST/Interp/Interp.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,9 @@ bool AddSubMulHelper(InterpState &S, CodePtr OpPC, unsigned Bits, const T &LHS,
287287
QualType Type = E->getType();
288288
if (S.checkingForUndefinedBehavior()) {
289289
SmallString<32> Trunc;
290-
Value.trunc(Result.bitWidth()).toString(Trunc, 10);
290+
Value.trunc(Result.bitWidth())
291+
.toString(Trunc, 10, Result.isSigned(), /*formatAsCLiteral=*/false,
292+
/*UpperCase=*/true, /*InsertSeparators=*/true);
291293
auto Loc = E->getExprLoc();
292294
S.report(Loc, diag::warn_integer_constant_overflow)
293295
<< Trunc << Type << E->getSourceRange();
@@ -499,7 +501,9 @@ bool Neg(InterpState &S, CodePtr OpPC) {
499501

500502
if (S.checkingForUndefinedBehavior()) {
501503
SmallString<32> Trunc;
502-
NegatedValue.trunc(Result.bitWidth()).toString(Trunc, 10);
504+
NegatedValue.trunc(Result.bitWidth())
505+
.toString(Trunc, 10, Result.isSigned(), /*formatAsCLiteral=*/false,
506+
/*UpperCase=*/true, /*InsertSeparators=*/true);
503507
auto Loc = E->getExprLoc();
504508
S.report(Loc, diag::warn_integer_constant_overflow)
505509
<< Trunc << Type << E->getSourceRange();
@@ -561,7 +565,9 @@ bool IncDecHelper(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
561565
QualType Type = E->getType();
562566
if (S.checkingForUndefinedBehavior()) {
563567
SmallString<32> Trunc;
564-
APResult.trunc(Result.bitWidth()).toString(Trunc, 10);
568+
APResult.trunc(Result.bitWidth())
569+
.toString(Trunc, 10, Result.isSigned(), /*formatAsCLiteral=*/false,
570+
/*UpperCase=*/true, /*InsertSeparators=*/true);
565571
auto Loc = E->getExprLoc();
566572
S.report(Loc, diag::warn_integer_constant_overflow)
567573
<< Trunc << Type << E->getSourceRange();

clang/test/AST/Interp/c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int chooseexpr[__builtin_choose_expr(1, 1, expr)];
9595

9696
int somefunc(int i) {
9797
return (i, 65537) * 65537; // all-warning {{left operand of comma operator has no effect}} \
98-
// all-warning {{overflow in expression; result is 131073}}
98+
// all-warning {{overflow in expression; result is 131'073 with type 'int'}}
9999
}
100100

101101
/// FIXME: The following test is incorrect in the new interpreter.

clang/test/C/drs/dr0xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ _Static_assert(__builtin_types_compatible_p(struct S { int a; }, union U { int a
214214
*/
215215
void dr031(int i) {
216216
switch (i) {
217-
case __INT_MAX__ + 1: break; /* expected-warning {{overflow in expression; result is -2147483648 with type 'int'}} */
217+
case __INT_MAX__ + 1: break; /* expected-warning {{overflow in expression; result is -2'147'483'648 with type 'int'}} */
218218
#pragma clang diagnostic push
219219
#pragma clang diagnostic ignored "-Wswitch"
220220
/* Silence the targets which issue:

clang/test/C/drs/dr2xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ void dr258(void) {
277277
void dr261(void) {
278278
/* This is still an integer constant expression despite the overflow. */
279279
enum e1 {
280-
ex1 = __INT_MAX__ + 1 /* expected-warning {{overflow in expression; result is -2147483648 with type 'int'}} */
280+
ex1 = __INT_MAX__ + 1 /* expected-warning {{overflow in expression; result is -2'147'483'648 with type 'int'}} */
281281
};
282282

283283
/* This is not an integer constant expression, because of the comma operator,

clang/test/Sema/integer-overflow.c

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,169 +11,169 @@ uint64_t f0(uint64_t);
1111
uint64_t f1(uint64_t, uint32_t);
1212
uint64_t f2(uint64_t, ...);
1313

14-
static const uint64_t overflow = 1 * 4608 * 1024 * 1024; // expected-warning {{overflow in expression; result is 536870912 with type 'int'}}
14+
static const uint64_t overflow = 1 * 4608 * 1024 * 1024; // expected-warning {{overflow in expression; result is 536'870'912 with type 'int'}}
1515

1616
uint64_t check_integer_overflows(int i) {
17-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
17+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
1818
uint64_t overflow = 4608 * 1024 * 1024,
19-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
19+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
2020
overflow2 = (uint64_t)(4608 * 1024 * 1024),
21-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
21+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
2222
overflow3 = (uint64_t)(4608 * 1024 * 1024 * i),
23-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
23+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
2424
overflow4 = (1ULL * ((4608) * ((1024) * (1024))) + 2ULL),
25-
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
25+
// expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
2626
multi_overflow = (uint64_t)((uint64_t)(4608 * 1024 * 1024) * (uint64_t)(4608 * 1024 * 1024));
2727

28-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
28+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
2929
overflow += overflow2 = overflow3 = (uint64_t)(4608 * 1024 * 1024);
30-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
30+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
3131
overflow += overflow2 = overflow3 = 4608 * 1024 * 1024;
3232

3333
uint64_t not_overflow = 4608 * 1024 * 1024ULL;
3434
uint64_t not_overflow2 = (1ULL * ((uint64_t)(4608) * (1024 * 1024)) + 2ULL);
3535

36-
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
36+
// expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
3737
overflow = 4608 * 1024 * 1024 ? 4608 * 1024 * 1024 : 0;
3838

39-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
39+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
4040
overflow = 0 ? 0 : 4608 * 1024 * 1024;
4141

42-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
42+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
4343
if (4608 * 1024 * 1024)
4444
return 0;
4545

46-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
46+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
4747
if ((uint64_t)(4608 * 1024 * 1024))
4848
return 1;
4949

50-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
50+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
5151
if ((uint64_t)(4608 * 1024 * 1024))
5252
return 2;
5353

54-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
54+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
5555
if ((uint64_t)(4608 * 1024 * 1024 * i))
5656
return 3;
5757

58-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
58+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
5959
if ((1ULL * ((4608) * ((1024) * (1024))) + 2ULL))
6060
return 4;
6161

62-
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
62+
// expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
6363
if ((uint64_t)((uint64_t)(4608 * 1024 * 1024) * (uint64_t)(4608 * 1024 * 1024)))
6464
return 5;
6565

6666
switch (i) {
67-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
67+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
6868
case 4608 * 1024 * 1024:
6969
return 6;
70-
// expected-warning@+1 {{overflow in expression; result is 537919488 with type 'int'}}
70+
// expected-warning@+1 {{overflow in expression; result is 537'919'488 with type 'int'}}
7171
case (uint64_t)(4609 * 1024 * 1024):
7272
return 7;
7373
// expected-error@+1 {{expression is not an integer constant expression}}
7474
case ((uint64_t)(4608 * 1024 * 1024 * i)):
7575
return 8;
76-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
76+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
7777
case ((1ULL * ((4608) * ((1024) * (1024))) + 2ULL)):
7878
return 9;
79-
// expected-warning@+2 2{{overflow in expression; result is 536870912 with type 'int'}}
79+
// expected-warning@+2 2{{overflow in expression; result is 536'870'912 with type 'int'}}
8080
// expected-warning@+1 {{overflow converting case value to switch condition type (288230376151711744 to 0)}}
8181
case ((uint64_t)((uint64_t)(4608 * 1024 * 1024) * (uint64_t)(4608 * 1024 * 1024))):
8282
return 10;
8383
}
8484

85-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
85+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
8686
while (4608 * 1024 * 1024);
8787

88-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
88+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
8989
while ((uint64_t)(4608 * 1024 * 1024));
9090

91-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
91+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
9292
while ((uint64_t)(4608 * 1024 * 1024));
9393

94-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
94+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
9595
while ((uint64_t)(4608 * 1024 * 1024 * i));
9696

97-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
97+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
9898
while ((1ULL * ((4608) * ((1024) * (1024))) + 2ULL));
9999

100-
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
100+
// expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
101101
while ((uint64_t)((uint64_t)(4608 * 1024 * 1024) * (uint64_t)(4608 * 1024 * 1024)));
102102

103-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
103+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
104104
do { } while (4608 * 1024 * 1024);
105105

106-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
106+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
107107
do { } while ((uint64_t)(4608 * 1024 * 1024));
108108

109-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
109+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
110110
do { } while ((uint64_t)(4608 * 1024 * 1024));
111111

112-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
112+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
113113
do { } while ((uint64_t)(4608 * 1024 * 1024 * i));
114114

115-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
115+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
116116
do { } while ((1ULL * ((4608) * ((1024) * (1024))) + 2ULL));
117117

118-
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
118+
// expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
119119
do { } while ((uint64_t)((uint64_t)(4608 * 1024 * 1024) * (uint64_t)(4608 * 1024 * 1024)));
120120

121-
// expected-warning@+3 {{overflow in expression; result is 536870912 with type 'int'}}
122-
// expected-warning@+3 {{overflow in expression; result is 536870912 with type 'int'}}
123-
// expected-warning@+3 {{overflow in expression; result is 536870912 with type 'int'}}
121+
// expected-warning@+3 {{overflow in expression; result is 536'870'912 with type 'int'}}
122+
// expected-warning@+3 {{overflow in expression; result is 536'870'912 with type 'int'}}
123+
// expected-warning@+3 {{overflow in expression; result is 536'870'912 with type 'int'}}
124124
for (uint64_t i = 4608 * 1024 * 1024;
125125
(uint64_t)(4608 * 1024 * 1024);
126126
i += (uint64_t)(4608 * 1024 * 1024 * i));
127127

128-
// expected-warning@+3 {{overflow in expression; result is 536870912 with type 'int'}}
129-
// expected-warning@+3 2{{overflow in expression; result is 536870912 with type 'int'}}
130-
// expected-warning@+3 2{{overflow in expression; result is 536870912 with type 'int'}}
128+
// expected-warning@+3 {{overflow in expression; result is 536'870'912 with type 'int'}}
129+
// expected-warning@+3 2{{overflow in expression; result is 536'870'912 with type 'int'}}
130+
// expected-warning@+3 2{{overflow in expression; result is 536'870'912 with type 'int'}}
131131
for (uint64_t i = (1ULL * ((4608) * ((1024) * (1024))) + 2ULL);
132132
((uint64_t)((uint64_t)(4608 * 1024 * 1024) * (uint64_t)(4608 * 1024 * 1024)));
133133
i = ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024))));
134134

135-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
135+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
136136
_Complex long long x = 4608 * 1024 * 1024;
137137

138-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
138+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
139139
(__real__ x) = 4608 * 1024 * 1024;
140140

141-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
141+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
142142
(__imag__ x) = 4608 * 1024 * 1024;
143143

144-
// expected-warning@+4 {{overflow in expression; result is 536870912 with type 'int'}}
144+
// expected-warning@+4 {{overflow in expression; result is 536'870'912 with type 'int'}}
145145
// expected-warning@+3 {{array index 536870912 is past the end of the array (that has type 'uint64_t[10]' (aka 'unsigned long long[10]'))}}
146146
// expected-note@+1 {{array 'a' declared here}}
147147
uint64_t a[10];
148148
a[4608 * 1024 * 1024] = 1i;
149149

150-
// expected-warning@+2 {{overflow in expression; result is 536870912 with type 'int'}}
150+
// expected-warning@+2 {{overflow in expression; result is 536'870'912 with type 'int'}}
151151
uint64_t *b;
152152
uint64_t b2 = b[4608 * 1024 * 1024] + 1;
153153

154-
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
154+
// expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
155155
(void)((i ? (4608 * 1024 * 1024) : (4608 * 1024 * 1024)) + 1);
156156

157-
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
157+
// expected-warning@+1 2{{overflow in expression; result is 536'870'912 with type 'int'}}
158158
return ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024)));
159159
}
160160

161161
void check_integer_overflows_in_function_calls(void) {
162-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
162+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
163163
(void)f0(4608 * 1024 * 1024);
164164

165-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
165+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
166166
uint64_t x = f0(4608 * 1024 * 1024);
167167

168-
// expected-warning@+2 {{overflow in expression; result is 536870912 with type 'int'}}
168+
// expected-warning@+2 {{overflow in expression; result is 536'870'912 with type 'int'}}
169169
uint64_t (*f0_ptr)(uint64_t) = &f0;
170170
(void)(*f0_ptr)(4608 * 1024 * 1024);
171171

172-
// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
172+
// expected-warning@+1 {{overflow in expression; result is 536'870'912 with type 'int'}}
173173
(void)f2(0, f0(4608 * 1024 * 1024));
174174
}
175175
void check_integer_overflows_in_array_size(void) {
176-
int arr[4608 * 1024 * 1024]; // expected-warning {{overflow in expression; result is 536870912 with type 'int'}}
176+
int arr[4608 * 1024 * 1024]; // expected-warning {{overflow in expression; result is 536'870'912 with type 'int'}}
177177
}
178178

179179
struct s {

clang/test/Sema/switch-1.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int f(int i) {
77
switch (i) {
88
case 2147483647 + 2:
99
#if (__cplusplus <= 199711L) // C or C++03 or earlier modes
10-
// expected-warning@-2 {{overflow in expression; result is -2147483647 with type 'int'}}
10+
// expected-warning@-2 {{overflow in expression; result is -2'147'483'647 with type 'int'}}
1111
#else
1212
// expected-error@-4 {{case value is not a constant expression}} \
1313
// expected-note@-4 {{value 2147483649 is outside the range of representable values of type 'int'}}
@@ -23,7 +23,7 @@ int f(int i) {
2323
return 2;
2424
case (123456 *789012) + 1:
2525
#if (__cplusplus <= 199711L)
26-
// expected-warning@-2 {{overflow in expression; result is -1375982336 with type 'int'}}
26+
// expected-warning@-2 {{overflow in expression; result is -1'375'982'336 with type 'int'}}
2727
#else
2828
// expected-error@-4 {{case value is not a constant expression}} \
2929
// expected-note@-4 {{value 97408265472 is outside the range of representable values of type 'int'}}
@@ -47,7 +47,7 @@ int f(int i) {
4747
case 2147483647:
4848
return 0;
4949
}
50-
return (i, 65537) * 65537; // expected-warning {{overflow in expression; result is 131073 with type 'int'}} \
50+
return (i, 65537) * 65537; // expected-warning {{overflow in expression; result is 131'073 with type 'int'}} \
5151
// expected-warning {{left operand of comma operator has no effect}}
5252
}
5353

clang/test/SemaCXX/enum.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ enum { overflow = 123456 * 234567 };
103103
// expected-warning@-2 {{not an integral constant expression}}
104104
// expected-note@-3 {{value 28958703552 is outside the range of representable values}}
105105
#else
106-
// expected-warning@-5 {{overflow in expression; result is -1106067520 with type 'int'}}
106+
// expected-warning@-5 {{overflow in expression; result is -1'106'067'520 with type 'int'}}
107107
#endif
108108

109109
// FIXME: This is not consistent with the above case.
@@ -112,7 +112,7 @@ enum NoFold : int { overflow2 = 123456 * 234567 };
112112
// expected-error@-2 {{enumerator value is not a constant expression}}
113113
// expected-note@-3 {{value 28958703552 is outside the range of representable values}}
114114
#else
115-
// expected-warning@-5 {{overflow in expression; result is -1106067520 with type 'int'}}
115+
// expected-warning@-5 {{overflow in expression; result is -1'106'067'520 with type 'int'}}
116116
// expected-warning@-6 {{extension}}
117117
#endif
118118

0 commit comments

Comments
 (0)