Skip to content

Commit f3f4952

Browse files
zyn0217tru
authored andcommitted
[Clang] Remove the special-casing for RequiresExprBodyDecl in BuildResolvedCallExpr() after fd87d76 (#111277)
The special-casing for RequiresExprBodyDecl caused a regression, as reported in #110785. The original fix for #84020 has been superseded by fd87d76, which establishes a `DependentScopeDeclRefExpr` instead of a `CXXDependentScopeMemberExpr` for the case in issue. So the spurious diagnostic in #84020 would no longer occur. This also merges the test for #84020 together with that for #110785 into clang/test/SemaTemplate/instantiate-requires-expr.cpp. No release note because I think this merits a backport. Fixes #110785 (cherry picked from commit 8c15470)
1 parent 33a5c88 commit f3f4952

File tree

4 files changed

+33
-26
lines changed

4 files changed

+33
-26
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6922,8 +6922,7 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
69226922
}
69236923

69246924
if (CXXMethodDecl *Method = dyn_cast_or_null<CXXMethodDecl>(FDecl))
6925-
if (!isa<RequiresExprBodyDecl>(CurContext) &&
6926-
Method->isImplicitObjectMemberFunction())
6925+
if (Method->isImplicitObjectMemberFunction())
69276926
return ExprError(Diag(LParenLoc, diag::err_member_call_without_object)
69286927
<< Fn->getSourceRange() << 0);
69296928

clang/lib/Sema/TreeTransform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13608,7 +13608,7 @@ bool TreeTransform<Derived>::TransformOverloadExprDecls(OverloadExpr *Old,
1360813608
}
1360913609

1361013610
AllEmptyPacks &= Decls.empty();
13611-
};
13611+
}
1361213612

1361313613
// C++ [temp.res]/8.4.2:
1361413614
// The program is ill-formed, no diagnostic required, if [...] lookup for

clang/test/SemaCXX/PR84020.cpp

Lines changed: 0 additions & 23 deletions
This file was deleted.

clang/test/SemaTemplate/instantiate-requires-expr.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,34 @@ constexpr bool e_v = true;
237237
static_assert(e_v<bool>);
238238

239239
} // namespace GH73885
240+
241+
namespace GH84020 {
242+
243+
struct B {
244+
template <typename S> void foo();
245+
void bar();
246+
};
247+
248+
template <typename T, typename S> struct A : T {
249+
void foo() {
250+
static_assert(requires { T::template foo<S>(); });
251+
static_assert(requires { T::bar(); });
252+
}
253+
};
254+
255+
template class A<B, double>;
256+
257+
} // namespace GH84020
258+
259+
namespace GH110785 {
260+
261+
struct Foo {
262+
static void f(auto) requires(false) {}
263+
void f(int) {}
264+
265+
static_assert([](auto v) {
266+
return requires { f(v); };
267+
} (0) == false);
268+
};
269+
270+
} // namespace GH110785

0 commit comments

Comments
 (0)