mirror of https://github.com/microsoft/clang.git
[SemaOverload] Fixed crash on code completion
Summary: The relevant failing assertion message is: ../tools/clang/lib/Sema/SemaInit.cpp:8411: PerformCopyInitialization(): Assertion `InitE && "No initialization expression?"' failed. See the added test case for a repro. Reviewers: bkramer, sammccall, ioeric, hokein Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44300 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327134 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
980e018010
commit
d218b6d945
|
@ -6245,12 +6245,17 @@ convertArgsForAvailabilityChecks(Sema &S, FunctionDecl *Function, Expr *ThisArg,
|
|||
if (!Function->isVariadic() && Args.size() < Function->getNumParams()) {
|
||||
for (unsigned i = Args.size(), e = Function->getNumParams(); i != e; ++i) {
|
||||
ParmVarDecl *P = Function->getParamDecl(i);
|
||||
ExprResult R = S.PerformCopyInitialization(
|
||||
InitializedEntity::InitializeParameter(S.Context,
|
||||
Function->getParamDecl(i)),
|
||||
SourceLocation(),
|
||||
P->hasUninstantiatedDefaultArg() ? P->getUninstantiatedDefaultArg()
|
||||
: P->getDefaultArg());
|
||||
Expr *DefArg = P->hasUninstantiatedDefaultArg()
|
||||
? P->getUninstantiatedDefaultArg()
|
||||
: P->getDefaultArg();
|
||||
// This can only happen in code completion, i.e. when PartialOverloading
|
||||
// is true.
|
||||
if (!DefArg)
|
||||
return false;
|
||||
ExprResult R =
|
||||
S.PerformCopyInitialization(InitializedEntity::InitializeParameter(
|
||||
S.Context, Function->getParamDecl(i)),
|
||||
SourceLocation(), DefArg);
|
||||
if (R.isInvalid())
|
||||
return false;
|
||||
ConvertedArgs.push_back(R.get());
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
int foo(bool x) __attribute__((enable_if(x, "")));
|
||||
|
||||
int test() {
|
||||
bool fffffff;
|
||||
// RUN: %clang_cc1 -std=c++11 -code-completion-at=%s:7:8 %s | FileCheck %s
|
||||
// CHECK: COMPLETION: fffffff : [#bool#]fffffff
|
||||
foo(ff
|
||||
}
|
Loading…
Reference in New Issue