]> granicus.if.org Git - clang/commitdiff
Canonicalize the declaration we write to a PCH file for an
authorDouglas Gregor <dgregor@apple.com>
Mon, 26 Mar 2012 15:52:37 +0000 (15:52 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 26 Mar 2012 15:52:37 +0000 (15:52 +0000)
InjectedClassNameType; otherwise, it won't be properly wired to the
original (canonical) declaration when it is deserialized. Fixes
<rdar://problem/11112464>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153442 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTWriter.cpp
test/PCH/cxx-templates.cpp
test/PCH/cxx-templates.h

index b746cff76e27cd15e27cb392baa9029e434678b6..a4301b53e872455bc83d57333b22ac0d456730ce 100644 (file)
@@ -365,7 +365,7 @@ void ASTTypeWriter::VisitElaboratedType(const ElaboratedType *T) {
 }
 
 void ASTTypeWriter::VisitInjectedClassNameType(const InjectedClassNameType *T) {
-  Writer.AddDeclRef(T->getDecl(), Record);
+  Writer.AddDeclRef(T->getDecl()->getCanonicalDecl(), Record);
   Writer.AddTypeRef(T->getInjectedSpecializationType(), Record);
   Code = TYPE_INJECTED_CLASS_NAME;
 }
index 982fc67e4e8a09eb26375c52491dfb107bf22770..7ce247721f8f0b7d2124344252566fa43bc8d5a1 100644 (file)
@@ -62,3 +62,9 @@ namespace Test1 {
     }
   };
 }
+
+template< typename D >
+Foo< D >& Foo< D >::operator=( const Foo& other )
+{
+   return *this;
+}
index c45e02dcb23c1718fe9931dc5b2b76e6fda0129d..152e8cef546475e584d9f4b131397dd75e20a58d 100644 (file)
@@ -205,3 +205,13 @@ namespace NonTypeTemplateParmContext {
   template<int inlineCapacity>
     inline bool equalIgnoringNullity(const Vector<char, inlineCapacity>& a, const String& b) { return false; }
 }
+
+// <rdar://problem/11112464>
+template< typename > class Foo;
+
+template< typename T >
+class Foo : protected T
+{
+ public:
+  Foo& operator=( const Foo& other );
+};