[llvm-branch-commits] [clang] 52c365a - Revert "[Concepts] Fix incorrect DeclContext for transformed RequiresExprBodyDecl"
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Mar 18 01:57:47 PDT 2020
Author: Hans Wennborg
Date: 2020-03-18T09:35:33+01:00
New Revision: 52c365aa9ca071dbd0d220463b2c4f8e21642b36
URL: https://github.com/llvm/llvm-project/commit/52c365aa9ca071dbd0d220463b2c4f8e21642b36
DIFF: https://github.com/llvm/llvm-project/commit/52c365aa9ca071dbd0d220463b2c4f8e21642b36.diff
LOG: Revert "[Concepts] Fix incorrect DeclContext for transformed RequiresExprBodyDecl"
We're not planning more release candidates for 10.0.0 at the moment, so
reverting for now.
This reverts commit 9e0bd5ec03cbc8d53048e92ddf7fd25bca17e912.
Added:
Modified:
clang/lib/Sema/TreeTransform.h
clang/test/SemaTemplate/instantiate-requires-expr.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 0305954a278e..805fe6684205 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -11303,7 +11303,7 @@ TreeTransform<Derived>::TransformRequiresExpr(RequiresExpr *E) {
SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
RequiresExprBodyDecl *Body = RequiresExprBodyDecl::Create(
- getSema().Context, getSema().CurContext,
+ getSema().Context, E->getBody()->getDeclContext(),
E->getBody()->getBeginLoc());
Sema::ContextRAII SavedContext(getSema(), Body, /*NewThisContext*/false);
diff --git a/clang/test/SemaTemplate/instantiate-requires-expr.cpp b/clang/test/SemaTemplate/instantiate-requires-expr.cpp
index ba82fc1313fc..927bc1bf8f12 100644
--- a/clang/test/SemaTemplate/instantiate-requires-expr.cpp
+++ b/clang/test/SemaTemplate/instantiate-requires-expr.cpp
@@ -164,19 +164,6 @@ namespace expr_requirement {
struct r3 {};
using r3i = r3<int, unsigned int>; // expected-error{{constraints not satisfied for class template 'r3' [with Ts = <int, unsigned int>]}}
-
- template<typename T>
- struct r4 {
- constexpr int foo() {
- if constexpr (requires { this->invalid(); })
- return 1;
- else
- return 0;
- }
-
- constexpr void invalid() requires false { }
- };
- static_assert(r4<int>{}.foo() == 0);
}
namespace nested_requirement {
More information about the llvm-branch-commits
mailing list