[modules] PR20475: merging support for alias template declarations.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 28 Jul 2014 21:16:37 +0000 (21:16 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 28 Jul 2014 21:16:37 +0000 (21:16 +0000)
llvm-svn: 214124

clang/lib/Serialization/ASTReaderDecl.cpp
clang/test/Modules/Inputs/cxx-templates-a.h
clang/test/Modules/Inputs/cxx-templates-b.h

index 9ed1bf9..44214f8 100644 (file)
@@ -2075,6 +2075,9 @@ void ASTDeclReader::mergeTemplatePattern(RedeclarableTemplateDecl *D,
                              Result);
   if (auto *DVar = dyn_cast<VarDecl>(DPattern))
     return mergeRedeclarable(DVar, cast<VarDecl>(ExistingPattern), Result);
+  if (auto *DAlias = dyn_cast<TypeAliasDecl>(DPattern))
+    return mergeRedeclarable(DAlias, cast<TypedefNameDecl>(ExistingPattern),
+                             Result);
   llvm_unreachable("merged an unknown kind of redeclarable template");
 }
 
index c95dc63..cfb8902 100644 (file)
@@ -73,3 +73,5 @@ template<typename T> struct MergeTemplateDefinitions {
   static constexpr int g();
 };
 template<typename T> constexpr int MergeTemplateDefinitions<T>::f() { return 1; }
+
+template<typename T> using AliasTemplate = T;
index efd07c6..802b926 100644 (file)
@@ -63,6 +63,8 @@ template<> struct MergeSpecializations<double> {
   typedef int explicitly_specialized_in_b;
 };
 
+template<typename U> using AliasTemplate = U;
+
 @import cxx_templates_a;
 template<typename T> void UseDefinedInBImplIndirectly(T &v) {
   PerformDelayedLookup(v);