diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-06-23 14:10:07 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-06-23 14:10:07 +0000 |
commit | bd5d53a9d06c7249efdb3edd7046ed8bf76433be (patch) | |
tree | 284fdee0b6084f5cef4c4f159ac789a80805aee7 /lib/Sema/SemaDeclCXX.cpp | |
parent | 598aad0fe0d99790d34390533e51e3d0e85531ef (diff) |
PR26195: Set correct NestedNameSpecifierLoc for the dependent initializer
This commit fixes incorrect source positions of dependent c'tor initializers
like in the following code:
template<typename MyBase>
struct Derived: MyBase::InnerIterator
{
Derived() : MyBase::InnerIterator() {} /// This line is problematic: all positions point to InnerIterator and nothing points to MyBase
};
Patch by Serge Preis!
Differential Revision: https://reviews.llvm.org/D32439
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 0b46e15bb0..27b5221fb9 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -3778,6 +3778,15 @@ Sema::BuildMemInitializer(Decl *ConstructorD, if (BaseType.isNull()) return true; + TInfo = Context.CreateTypeSourceInfo(BaseType); + DependentNameTypeLoc TL = + TInfo->getTypeLoc().castAs<DependentNameTypeLoc>(); + if (!TL.isNull()) { + TL.setNameLoc(IdLoc); + TL.setElaboratedKeywordLoc(SourceLocation()); + TL.setQualifierLoc(SS.getWithLocInContext(Context)); + } + R.clear(); R.setLookupName(MemberOrBase); } |