diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2010-07-09 22:21:32 +0000 | 
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-07-09 22:21:32 +0000 | 
| commit | 4239aa104ba0a2ff503e2d421e3bd5b0d777a24b (patch) | |
| tree | 07fb60eece93d913569085d8375a7b7737179ae7 /clang/lib/Sema/SemaExpr.cpp | |
| parent | 098039e4f09f5582840ddfd5c7e26ee4fab20fdc (diff) | |
| download | bcm5719-llvm-4239aa104ba0a2ff503e2d421e3bd5b0d777a24b.tar.gz bcm5719-llvm-4239aa104ba0a2ff503e2d421e3bd5b0d777a24b.zip | |
BlockDeclRefExpr of a dependent type must
be a dependent expression when its is built.
llvm-svn: 108026
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 29 | 
1 files changed, 16 insertions, 13 deletions
| diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index dfa472cc26b..a9a3b2c8ce4 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1748,22 +1748,25 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,                                                              ExprTy, Loc, false,                                                              constAdded);      QualType T = VD->getType(); -    if (getLangOptions().CPlusPlus && !T->isDependentType() && -        !T->isReferenceType()) { -      Expr *E = new (Context)  -                  DeclRefExpr(const_cast<ValueDecl*>(BDRE->getDecl()), T, -                                         SourceLocation()); +    if (getLangOptions().CPlusPlus) { +      if (!T->isDependentType() && !T->isReferenceType()) { +        Expr *E = new (Context)  +                    DeclRefExpr(const_cast<ValueDecl*>(BDRE->getDecl()), T, +                                          SourceLocation()); -      OwningExprResult Res = PerformCopyInitialization( -                      InitializedEntity::InitializeBlock(VD->getLocation(),  +        OwningExprResult Res = PerformCopyInitialization( +                          InitializedEntity::InitializeBlock(VD->getLocation(),                                                            T, false), -                      SourceLocation(), -                      Owned(E)); -      if (!Res.isInvalid()) { -        Res = MaybeCreateCXXExprWithTemporaries(move(Res)); -        Expr *Init = Res.takeAs<Expr>(); -        BDRE->setCopyConstructorExpr(Init); +                                                         SourceLocation(), +                                                         Owned(E)); +        if (!Res.isInvalid()) { +          Res = MaybeCreateCXXExprWithTemporaries(move(Res)); +          Expr *Init = Res.takeAs<Expr>(); +          BDRE->setCopyConstructorExpr(Init); +        }        } +      else if (T->isDependentType()) +        BDRE->setTypeDependent(true);      }      return Owned(BDRE);    } | 

