forked from OSchip/llvm-project
Check that the default argument is well-formed before checking the initializer types.
llvm-svn: 79964
This commit is contained in:
parent
34e6148dc8
commit
f1c2695d48
|
@ -124,6 +124,13 @@ Sema::ActOnParamDefaultArgument(DeclPtrTy param, SourceLocation EqualLoc,
|
|||
return;
|
||||
}
|
||||
|
||||
// Check that the default argument is well-formed
|
||||
CheckDefaultArgumentVisitor DefaultArgChecker(DefaultArg.get(), this);
|
||||
if (DefaultArgChecker.Visit(DefaultArg.get())) {
|
||||
Param->setInvalidDecl();
|
||||
return;
|
||||
}
|
||||
|
||||
// C++ [dcl.fct.default]p5
|
||||
// A default argument expression is implicitly converted (clause
|
||||
// 4) to the parameter type. The default argument expression has
|
||||
|
@ -143,13 +150,6 @@ Sema::ActOnParamDefaultArgument(DeclPtrTy param, SourceLocation EqualLoc,
|
|||
return;
|
||||
}
|
||||
|
||||
// Check that the default argument is well-formed
|
||||
CheckDefaultArgumentVisitor DefaultArgChecker(DefaultArg.get(), this);
|
||||
if (DefaultArgChecker.Visit(DefaultArg.get())) {
|
||||
Param->setInvalidDecl();
|
||||
return;
|
||||
}
|
||||
|
||||
DefaultArgPtr = MaybeCreateCXXExprWithTemporaries(DefaultArg.take(),
|
||||
/*DestroyTemps=*/false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue