diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-03-26 15:52:37 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-03-26 15:52:37 +0000 |
commit | 9f21889a7d5b0782ca2335833fa5bc38abdaa45c (patch) | |
tree | 9289e93dc57d709f744d13bdeb9c516d89fd88a8 | |
parent | e6f5123e16debe7b6894827aec14f42ecddd89bf (diff) | |
download | bcm5719-llvm-9f21889a7d5b0782ca2335833fa5bc38abdaa45c.tar.gz bcm5719-llvm-9f21889a7d5b0782ca2335833fa5bc38abdaa45c.zip |
Canonicalize the declaration we write to a PCH file for an
InjectedClassNameType; otherwise, it won't be properly wired to the
original (canonical) declaration when it is deserialized. Fixes
<rdar://problem/11112464>.
llvm-svn: 153442
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 2 | ||||
-rw-r--r-- | clang/test/PCH/cxx-templates.cpp | 6 | ||||
-rw-r--r-- | clang/test/PCH/cxx-templates.h | 10 |
3 files changed, 17 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index b746cff76e2..a4301b53e87 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -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; } diff --git a/clang/test/PCH/cxx-templates.cpp b/clang/test/PCH/cxx-templates.cpp index 982fc67e4e8..7ce247721f8 100644 --- a/clang/test/PCH/cxx-templates.cpp +++ b/clang/test/PCH/cxx-templates.cpp @@ -62,3 +62,9 @@ namespace Test1 { } }; } + +template< typename D > +Foo< D >& Foo< D >::operator=( const Foo& other ) +{ + return *this; +} diff --git a/clang/test/PCH/cxx-templates.h b/clang/test/PCH/cxx-templates.h index c45e02dcb23..152e8cef546 100644 --- a/clang/test/PCH/cxx-templates.h +++ b/clang/test/PCH/cxx-templates.h @@ -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 ); +}; |