From 0439f03bcf501c1bfa1892d2c119ca068c1fe159 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Tue, 2 Oct 2012 13:06:13 +0000 Subject: [PATCH] Add redecls into their lexical DeclContext: this is what they assert on, and the merging should have set it correctly. This is especially relevant for templatedDecls that might be injected (and thus have their DeclContext set to) somewhere completely different. llvm-svn: 165005 --- clang/lib/Serialization/ASTReaderDecl.cpp | 2 +- clang/test/Modules/Inputs/templates-top.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index e770c06..4f2da6b 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1775,7 +1775,7 @@ ASTDeclReader::FindExistingResult::~FindExistingResult() { if (!AddResult || Existing) return; - DeclContext *DC = New->getDeclContext()->getRedeclContext(); + DeclContext *DC = New->getLexicalDeclContext(); if (DC->isTranslationUnit() && Reader.SemaObj) { if (Reader.SemaObj->IdResolver.tryAddTopLevelDecl(New, New->getDeclName())) Reader.RedeclsAddedToAST.insert(New); diff --git a/clang/test/Modules/Inputs/templates-top.h b/clang/test/Modules/Inputs/templates-top.h index 80ecf23..5985ee8 100644 --- a/clang/test/Modules/Inputs/templates-top.h +++ b/clang/test/Modules/Inputs/templates-top.h @@ -4,3 +4,14 @@ template class List { public: void push_back(T); }; + +namespace A { + class Y { + template friend class WhereAmI; + }; +} + +template class A::WhereAmI { +public: + static void func() {} +}; -- 2.7.4