[Clang] Remove the special-casing for RequiresExprBodyDecl in BuildResolvedCallExpr() after fd87d765c0 (#111277)
The special-casing for RequiresExprBodyDecl caused a regression, as reported in #110785. The original fix for #84020 has been superseded by fd87d765c0, 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 8c1547055eaf65003f3e6fd024195f4926ff2356)
This commit is contained in:
parent
33a5c88572
commit
f3f49528c4
@ -6922,8 +6922,7 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
|
||||
}
|
||||
|
||||
if (CXXMethodDecl *Method = dyn_cast_or_null<CXXMethodDecl>(FDecl))
|
||||
if (!isa<RequiresExprBodyDecl>(CurContext) &&
|
||||
Method->isImplicitObjectMemberFunction())
|
||||
if (Method->isImplicitObjectMemberFunction())
|
||||
return ExprError(Diag(LParenLoc, diag::err_member_call_without_object)
|
||||
<< Fn->getSourceRange() << 0);
|
||||
|
||||
|
@ -13608,7 +13608,7 @@ bool TreeTransform<Derived>::TransformOverloadExprDecls(OverloadExpr *Old,
|
||||
}
|
||||
|
||||
AllEmptyPacks &= Decls.empty();
|
||||
};
|
||||
}
|
||||
|
||||
// C++ [temp.res]/8.4.2:
|
||||
// The program is ill-formed, no diagnostic required, if [...] lookup for
|
||||
|
@ -1,23 +0,0 @@
|
||||
// RUN: %clang_cc1 -std=c++20 -verify %s
|
||||
// RUN: %clang_cc1 -std=c++23 -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
struct B {
|
||||
template <typename S>
|
||||
void foo();
|
||||
|
||||
void bar();
|
||||
};
|
||||
|
||||
template <typename T, typename S>
|
||||
struct A : T {
|
||||
auto foo() {
|
||||
static_assert(requires { T::template foo<S>(); });
|
||||
static_assert(requires { T::bar(); });
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
A<B, double> a;
|
||||
a.foo();
|
||||
}
|
@ -237,3 +237,34 @@ constexpr bool e_v = true;
|
||||
static_assert(e_v<bool>);
|
||||
|
||||
} // namespace GH73885
|
||||
|
||||
namespace GH84020 {
|
||||
|
||||
struct B {
|
||||
template <typename S> void foo();
|
||||
void bar();
|
||||
};
|
||||
|
||||
template <typename T, typename S> struct A : T {
|
||||
void foo() {
|
||||
static_assert(requires { T::template foo<S>(); });
|
||||
static_assert(requires { T::bar(); });
|
||||
}
|
||||
};
|
||||
|
||||
template class A<B, double>;
|
||||
|
||||
} // namespace GH84020
|
||||
|
||||
namespace GH110785 {
|
||||
|
||||
struct Foo {
|
||||
static void f(auto) requires(false) {}
|
||||
void f(int) {}
|
||||
|
||||
static_assert([](auto v) {
|
||||
return requires { f(v); };
|
||||
} (0) == false);
|
||||
};
|
||||
|
||||
} // namespace GH110785
|
||||
|
Loading…
x
Reference in New Issue
Block a user