Skip to content

Commit fbb9dc9

Browse files
committed
Fix tests
1 parent 9574928 commit fbb9dc9

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14590,8 +14590,8 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
1459014590
const Expr *RHSExpr = RHSValue.Base.dyn_cast<const Expr *>();
1459114591

1459214592
auto DiagArith = [&](unsigned DiagID) {
14593-
std::string LHS = LHSValue.toString(Info.Ctx, LHSExpr->getType());
14594-
std::string RHS = RHSValue.toString(Info.Ctx, RHSExpr->getType());
14593+
std::string LHS = LHSValue.toString(Info.Ctx, E->getLHS()->getType());
14594+
std::string RHS = RHSValue.toString(Info.Ctx, E->getRHS()->getType());
1459514595
Info.FFDiag(E, DiagID) << LHS << RHS;
1459614596
if (LHSExpr && LHSExpr == RHSExpr)
1459714597
Info.Note(LHSExpr->getExprLoc(),

clang/test/AST/ByteCode/builtin-functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ namespace FunctionStart {
10101010
void a(void) {}
10111011
static_assert(__builtin_function_start(a) == a, ""); // both-error {{not an integral constant expression}} \
10121012
// ref-note {{comparison against opaque constant address '&__builtin_function_start(a)'}} \
1013-
// expected-note {{comparison of addresses of literals has unspecified value}}
1013+
// expected-note {{comparison of addresses of potentially overlapping literals has unspecified value}}
10141014
}
10151015

10161016
namespace BuiltinInImplicitCtor {

clang/test/AST/ByteCode/cxx20.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ constexpr auto name1() { return "name1"; }
115115
constexpr auto name2() { return "name2"; }
116116

117117
constexpr auto b3 = name1() == name1(); // ref-error {{must be initialized by a constant expression}} \
118-
// ref-note {{comparison of addresses of literals}}
118+
// ref-note {{comparison of addresses of potentially overlapping literals}}
119119
constexpr auto b4 = name1() == name2();
120120
static_assert(!b4);
121121

clang/test/AST/ByteCode/functions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ namespace Comparison {
208208

209209
constexpr bool u13 = pf < pg; // both-warning {{ordered comparison of function pointers}} \
210210
// both-error {{must be initialized by a constant expression}} \
211-
// both-note {{comparison between '&f' and '&g' has unspecified value}}
211+
// both-note {{comparison between pointers to unrelated objects '&f' and '&g' has unspecified value}}
212212

213213
constexpr bool u14 = pf < (void(*)())nullptr; // both-warning {{ordered comparison of function pointers}} \
214214
// both-error {{must be initialized by a constant expression}} \
215-
// both-note {{comparison between '&f' and 'nullptr' has unspecified value}}
215+
// both-note {{comparison between pointers to unrelated objects '&f' and 'nullptr' has unspecified value}}
216216

217217

218218

clang/test/AST/ByteCode/literals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ namespace PointerComparison {
194194
constexpr void *qv = (void*)&s.b;
195195
constexpr bool v1 = null < (int*)0;
196196
constexpr bool v2 = null < pv; // both-error {{must be initialized by a constant expression}} \
197-
// both-note {{comparison between 'nullptr' and '&s.a' has unspecified value}}
197+
// both-note {{comparison between pointers to unrelated objects 'nullptr' and '&s.a' has unspecified value}}
198198

199199
constexpr bool v3 = null == pv; // ok
200200
constexpr bool v4 = qv == pv; // ok
201201

202202
constexpr bool v5 = qv >= pv;
203203
constexpr bool v8 = qv > (void*)&s.a;
204204
constexpr bool v6 = qv > null; // both-error {{must be initialized by a constant expression}} \
205-
// both-note {{comparison between '&s.b' and 'nullptr' has unspecified value}}
205+
// both-note {{comparison between pointers to unrelated objects '&s.b' and 'nullptr' has unspecified value}}
206206

207207
constexpr bool v7 = qv <= (void*)&s.b; // ok
208208

clang/test/CXX/expr/expr.const/p2-0x.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -510,22 +510,22 @@ namespace UnspecifiedRelations {
510510
// different objects that are not members of the same array or to different
511511
// functions, or if only one of them is null, the results of p<q, p>q, p<=q,
512512
// and p>=q are unspecified.
513-
constexpr bool u1 = p < q; // expected-error {{constant expression}} expected-note {{comparison between '&a' and '&b' has unspecified value}}
514-
constexpr bool u2 = p > q; // expected-error {{constant expression}} expected-note {{comparison between '&a' and '&b' has unspecified value}}
515-
constexpr bool u3 = p <= q; // expected-error {{constant expression}} expected-note {{comparison between '&a' and '&b' has unspecified value}}
516-
constexpr bool u4 = p >= q; // expected-error {{constant expression}} expected-note {{comparison between '&a' and '&b' has unspecified value}}
517-
constexpr bool u5 = p < (int*)0; // expected-error {{constant expression}} expected-note {{comparison between '&a' and 'nullptr' has unspecified value}}
518-
constexpr bool u6 = p <= (int*)0; // expected-error {{constant expression}} expected-note {{comparison between '&a' and 'nullptr' has unspecified value}}
519-
constexpr bool u7 = p > (int*)0; // expected-error {{constant expression}} expected-note {{comparison between '&a' and 'nullptr' has unspecified value}}
520-
constexpr bool u8 = p >= (int*)0; // expected-error {{constant expression}} expected-note {{comparison between '&a' and 'nullptr' has unspecified value}}
521-
constexpr bool u9 = (int*)0 < q; // expected-error {{constant expression}} expected-note {{comparison between 'nullptr' and '&b' has unspecified value}}
522-
constexpr bool u10 = (int*)0 <= q; // expected-error {{constant expression}} expected-note {{comparison between 'nullptr' and '&b' has unspecified value}}
523-
constexpr bool u11 = (int*)0 > q; // expected-error {{constant expression}} expected-note {{comparison between 'nullptr' and '&b' has unspecified value}}
524-
constexpr bool u12 = (int*)0 >= q; // expected-error {{constant expression}} expected-note {{comparison between 'nullptr' and '&b' has unspecified value}}
513+
constexpr bool u1 = p < q; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&a' and '&b' has unspecified value}}
514+
constexpr bool u2 = p > q; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&a' and '&b' has unspecified value}}
515+
constexpr bool u3 = p <= q; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&a' and '&b' has unspecified value}}
516+
constexpr bool u4 = p >= q; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&a' and '&b' has unspecified value}}
517+
constexpr bool u5 = p < (int*)0; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&a' and 'nullptr' has unspecified value}}
518+
constexpr bool u6 = p <= (int*)0; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&a' and 'nullptr' has unspecified value}}
519+
constexpr bool u7 = p > (int*)0; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&a' and 'nullptr' has unspecified value}}
520+
constexpr bool u8 = p >= (int*)0; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&a' and 'nullptr' has unspecified value}}
521+
constexpr bool u9 = (int*)0 < q; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects 'nullptr' and '&b' has unspecified value}}
522+
constexpr bool u10 = (int*)0 <= q; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects 'nullptr' and '&b' has unspecified value}}
523+
constexpr bool u11 = (int*)0 > q; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects 'nullptr' and '&b' has unspecified value}}
524+
constexpr bool u12 = (int*)0 >= q; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects 'nullptr' and '&b' has unspecified value}}
525525
void f(), g();
526526

527527
constexpr void (*pf)() = &f, (*pg)() = &g;
528-
constexpr bool u13 = pf < pg; // expected-error {{constant expression}} expected-note {{comparison between '&f' and '&g' has unspecified value}}
528+
constexpr bool u13 = pf < pg; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&f' and '&g' has unspecified value}}
529529
// expected-warning@-1 {{ordered comparison of function pointers}}
530530
constexpr bool u14 = pf == pg;
531531

@@ -578,11 +578,11 @@ namespace UnspecifiedRelations {
578578
constexpr void *pv = (void*)&s.a;
579579
constexpr void *qv = (void*)&s.b;
580580
constexpr bool v1 = null < (int*)0;
581-
constexpr bool v2 = null < pv; // expected-error {{constant expression}} expected-note {{comparison between 'nullptr' and '&s.a' has unspecified value}}
581+
constexpr bool v2 = null < pv; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects 'nullptr' and '&s.a' has unspecified value}}
582582
constexpr bool v3 = null == pv;
583583
constexpr bool v4 = qv == pv;
584584
constexpr bool v5 = qv >= pv;
585-
constexpr bool v6 = qv > null; // expected-error {{constant expression}} expected-note {{comparison between '&s.b' and 'nullptr' has unspecified value}}
585+
constexpr bool v6 = qv > null; // expected-error {{constant expression}} expected-note {{comparison between pointers to unrelated objects '&s.b' and 'nullptr' has unspecified value}}
586586
constexpr bool v7 = qv <= (void*)&s.b;
587587
constexpr bool v8 = qv > (void*)&s.a;
588588
}

clang/test/SemaCXX/constant-expression-cxx11.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,17 +380,17 @@ static_assert(string == string, "");
380380
static_assert(string == also_string, "");
381381

382382
// These strings may overlap, and so the result of the comparison is unknown.
383-
constexpr bool may_overlap_1 = +"foo" == +"foo"; // expected-error {{}} expected-note {{addresses of literals}}
384-
constexpr bool may_overlap_2 = +"foo" == +"foo\0bar"; // expected-error {{}} expected-note {{addresses of literals}}
385-
constexpr bool may_overlap_3 = +"foo" == "bar\0foo" + 4; // expected-error {{}} expected-note {{addresses of literals}}
386-
constexpr bool may_overlap_4 = "xfoo" + 1 == "xfoo" + 1; // expected-error {{}} expected-note {{addresses of literals}}
383+
constexpr bool may_overlap_1 = +"foo" == +"foo"; // expected-error {{}} expected-note {{addresses of potentially overlapping literals}}
384+
constexpr bool may_overlap_2 = +"foo" == +"foo\0bar"; // expected-error {{}} expected-note {{addresses of potentially overlapping literals}}
385+
constexpr bool may_overlap_3 = +"foo" == "bar\0foo" + 4; // expected-error {{}} expected-note {{addresses of potentially overlapping literals}}
386+
constexpr bool may_overlap_4 = "xfoo" + 1 == "xfoo" + 1; // expected-error {{}} expected-note {{addresses of potentially overlapping literals}}
387387

388388
// These may overlap even though they have different encodings.
389389
// One of these two comparisons is non-constant, but due to endianness we don't
390390
// know which one.
391391
constexpr bool may_overlap_different_encoding[] =
392392
{fold((const char*)u"A" != (const char*)"xA\0\0\0x" + 1), fold((const char*)u"A" != (const char*)"x\0A\0\0x" + 1)};
393-
// expected-error@-2 {{}} expected-note@-1 {{addresses of literals}}
393+
// expected-error@-2 {{}} expected-note@-1 {{addresses of potentially overlapping literals}}
394394

395395
}
396396

clang/test/SemaCXX/constant-expression-cxx14.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ constexpr bool different_in_loop(bool b = false) {
13151315
const char *p[2] = {};
13161316
for (const char *&r : p)
13171317
r = "hello";
1318-
return p[0] == p[1]; // expected-note {{addresses of literals}}
1318+
return p[0] == p[1]; // expected-note {{addresses of potentially overlapping literals}}
13191319
}
13201320
constexpr bool check = different_in_loop();
13211321
// expected-error@-1 {{}} expected-note@-1 {{in call}}

0 commit comments

Comments
 (0)