[clang] 08d46d5 - [clang][PATCH] Fix bug 48848 assertion related to recoverFromMSUnqualifiedLookup
Melanie Blower via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 1 10:57:05 PST 2021
Author: Melanie Blower
Date: 2021-02-01T10:56:47-08:00
New Revision: 08d46d50599a7005380e1a9eebb276ceb2b0ad93
URL: https://github.com/llvm/llvm-project/commit/08d46d50599a7005380e1a9eebb276ceb2b0ad93
DIFF: https://github.com/llvm/llvm-project/commit/08d46d50599a7005380e1a9eebb276ceb2b0ad93.diff
LOG: [clang][PATCH] Fix bug 48848 assertion related to recoverFromMSUnqualifiedLookup
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D95482
Added:
Modified:
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/lambda-expressions.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index d91db60f17a0..a708ccd58dd4 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1176,15 +1176,11 @@ QualType Sema::getCurrentThisType() {
}
if (ThisTy.isNull() && isLambdaCallOperator(CurContext) &&
- inTemplateInstantiation()) {
-
- assert(isa<CXXRecordDecl>(DC) &&
- "Trying to get 'this' type from static method?");
+ inTemplateInstantiation() && isa<CXXRecordDecl>(DC)) {
// This is a lambda call operator that is being instantiated as a default
// initializer. DC must point to the enclosing class type, so we can recover
// the 'this' type from it.
-
QualType ClassTy = Context.getTypeDeclType(cast<CXXRecordDecl>(DC));
// There are no cv-qualifiers for 'this' within default initializers,
// per [expr.prim.general]p4.
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp
index 22e0939379f5..03bf13733d7b 100644
--- a/clang/test/SemaCXX/lambda-expressions.cpp
+++ b/clang/test/SemaCXX/lambda-expressions.cpp
@@ -1,6 +1,8 @@
// RUN: %clang_cc1 -std=c++14 -Wno-unused-value -fsyntax-only -verify -verify=expected-cxx14 -fblocks %s
// RUN: %clang_cc1 -std=c++17 -Wno-unused-value -fsyntax-only -verify -fblocks %s
+// RUN: %clang_cc1 -std=c++17 -fblocks -DSHOW_MS -Wno-unused-value -fms-compatibility -fdelayed-template-parsing -fsyntax-only -verify %s
+#ifndef SHOW_MS
namespace std { class type_info; };
namespace ExplicitCapture {
@@ -664,3 +666,22 @@ void Test() {
}
};
+
+#else
+template <typename RT, typename ET>
+void Decider(const RT &sp, ET &ep) {
+ [=](auto i) { ep[i] = sp[i + j]; };
+ // expected-error at -1 {{use of undeclared identifier 'j'}}
+}
+
+template <typename EMT> void LS() {
+ int *ep;
+ Decider(5, ep);
+}
+
+void runChapter4()
+{
+ LS<int>(); // expected-note {{in instantiation of}}
+}
+
+#endif
More information about the cfe-commits
mailing list