From 049fcd8c64eab276ead88ee4245bb4266ddabc0f Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 29 Jul 2014 00:58:01 +0000 Subject: [PATCH] [modules] Add testcase for a bug reduced from a selfhost issue. This bug was never present in Clang trunk, but was present in some of my development work, and it seems like a useful test to have. llvm-svn: 214154 --- clang/test/Modules/Inputs/cxx-templates-a.h | 7 +++++++ clang/test/Modules/Inputs/cxx-templates-b.h | 1 + clang/test/Modules/cxx-templates.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/clang/test/Modules/Inputs/cxx-templates-a.h b/clang/test/Modules/Inputs/cxx-templates-a.h index cfb8902..0289c8a 100644 --- a/clang/test/Modules/Inputs/cxx-templates-a.h +++ b/clang/test/Modules/Inputs/cxx-templates-a.h @@ -75,3 +75,10 @@ template struct MergeTemplateDefinitions { template constexpr int MergeTemplateDefinitions::f() { return 1; } template using AliasTemplate = T; + +template struct PartiallyInstantiatePartialSpec {}; +template struct PartiallyInstantiatePartialSpec { + static T *foo() { return reinterpret_cast(0); } + static T *bar() { return reinterpret_cast(0); } +}; +typedef PartiallyInstantiatePartialSpec PartiallyInstantiatePartialSpecHelper; diff --git a/clang/test/Modules/Inputs/cxx-templates-b.h b/clang/test/Modules/Inputs/cxx-templates-b.h index 802b926..5dbf1a1 100644 --- a/clang/test/Modules/Inputs/cxx-templates-b.h +++ b/clang/test/Modules/Inputs/cxx-templates-b.h @@ -73,4 +73,5 @@ template void UseDefinedInBImplIndirectly(T &v) { void TriggerInstantiation() { UseDefinedInBImpl(); Std::f(); + PartiallyInstantiatePartialSpec::foo(); } diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp index cbe9f35..b5036ff 100644 --- a/clang/test/Modules/cxx-templates.cpp +++ b/clang/test/Modules/cxx-templates.cpp @@ -105,6 +105,7 @@ void g() { int &p = WithPartialSpecializationUse().f(); int &q = WithExplicitSpecializationUse().inner_template(); + int *r = PartiallyInstantiatePartialSpec::bar(); } static_assert(Outer::Inner::f() == 1, ""); -- 2.7.4