forked from OSchip/llvm-project
[clang][PATCH] Fix bug 48848 assertion related to recoverFromMSUnqualifiedLookup
Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D95482
This commit is contained in:
parent
0ce2920f17
commit
08d46d5059
|
@ -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.
|
||||
|
|
|
@ -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@-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
|
||||
|
|
Loading…
Reference in New Issue