diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-09-14 04:20:37 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-09-14 04:20:37 +0000 |
commit | 6d149412c8619c83e4ab7de0dbd836d251b015ad (patch) | |
tree | f55fa93368d262e1716d3c30197ec291bca6f6f9 /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | 1ec4a5e190e97d41bdaa70a5f0cb3e50fa60a821 (diff) | |
download | bcm5719-llvm-6d149412c8619c83e4ab7de0dbd836d251b015ad.tar.gz bcm5719-llvm-6d149412c8619c83e4ab7de0dbd836d251b015ad.zip |
As we do with base and member initializers in a dependent class, delay
type checking for non-static data member initializers in a dependent
class, because our ASTs lose too much information to when
type-checking an initializer. Fixes <rdar://problem/11974632>,
although the result is still rather unsatisfactory.
llvm-svn: 163871
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 5ee28da4efa..7c97453d6fc 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1702,7 +1702,11 @@ Sema::ActOnCXXInClassMemberInitializer(Decl *D, SourceLocation InitLoc, } ExprResult Init = InitExpr; - if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) { + if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent() && + !FD->getDeclContext()->isDependentContext()) { + // Note: We don't type-check when we're in a dependent context, because + // the initialization-substitution code does not properly handle direct + // list initialization. We have the same hackaround for ctor-initializers. if (isa<InitListExpr>(InitExpr) && isStdInitializerList(FD->getType(), 0)) { Diag(FD->getLocation(), diag::warn_dangling_std_initializer_list) << /*at end of ctor*/1 << InitExpr->getSourceRange(); |