diff options
| author | Douglas Gregor <dgregor@apple.com> | 2008-11-04 13:57:51 +0000 | 
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2008-11-04 13:57:51 +0000 | 
| commit | 5496d4caa086bf4960bde26ce57e6669dbfeb5b8 (patch) | |
| tree | 3a9e51ff217f525108971eead8395ed4031861b4 /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | 8e12c3811554bed6521152e55e4b500a83f82680 (diff) | |
| download | bcm5719-llvm-5496d4caa086bf4960bde26ce57e6669dbfeb5b8.tar.gz bcm5719-llvm-5496d4caa086bf4960bde26ce57e6669dbfeb5b8.zip | |
Now that we have copy initialization support, use it for checking the default arguments
llvm-svn: 58692
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 14 | 
1 files changed, 3 insertions, 11 deletions
| diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index bd3da49030e..33fc52b71dc 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -126,22 +126,14 @@ Sema::ActOnParamDefaultArgument(DeclTy *param, SourceLocation EqualLoc,    //   the same semantic constraints as the initializer expression in    //   a declaration of a variable of the parameter type, using the    //   copy-initialization semantics (8.5). -  // -  // FIXME: CheckSingleAssignmentConstraints has the wrong semantics -  // for C++ (since we want copy-initialization, not copy-assignment), -  // but we don't have the right semantics implemented yet. Because of -  // this, our error message is also very poor. -  QualType DefaultArgType = DefaultArg->getType();       Expr *DefaultArgPtr = DefaultArg.get(); -  AssignConvertType ConvTy = CheckSingleAssignmentConstraints(ParamType, -                                                              DefaultArgPtr); +  bool DefaultInitFailed = PerformCopyInitialization(DefaultArgPtr, ParamType, +                                                     "in default argument");    if (DefaultArgPtr != DefaultArg.get()) {      DefaultArg.take();      DefaultArg.reset(DefaultArgPtr);    } -  if (DiagnoseAssignmentResult(ConvTy, DefaultArg->getLocStart(),  -                               ParamType, DefaultArgType, DefaultArg.get(),  -                               "in default argument")) { +  if (DefaultInitFailed) {      return;    } | 

