Check that the default argument is well-formed before checking the initializer types.

llvm-svn: 79964
This commit is contained in:
Anders Carlsson 2009-08-25 01:02:06 +00:00
parent 34e6148dc8
commit f1c2695d48
1 changed files with 7 additions and 7 deletions

View File

@ -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);