r214154 - [modules] Add testcase for a bug reduced from a selfhost issue. This bug was

Richard Smith richard-llvm at metafoo.co.uk
Mon Jul 28 17:58:01 PDT 2014


Author: rsmith
Date: Mon Jul 28 19:58:01 2014
New Revision: 214154

URL: http://llvm.org/viewvc/llvm-project?rev=214154&view=rev
Log:
[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.

Modified:
    cfe/trunk/test/Modules/Inputs/cxx-templates-a.h
    cfe/trunk/test/Modules/Inputs/cxx-templates-b.h
    cfe/trunk/test/Modules/cxx-templates.cpp

Modified: cfe/trunk/test/Modules/Inputs/cxx-templates-a.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-templates-a.h?rev=214154&r1=214153&r2=214154&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-templates-a.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-templates-a.h Mon Jul 28 19:58:01 2014
@@ -75,3 +75,10 @@ template<typename T> struct MergeTemplat
 template<typename T> constexpr int MergeTemplateDefinitions<T>::f() { return 1; }
 
 template<typename T> using AliasTemplate = T;
+
+template<typename T> struct PartiallyInstantiatePartialSpec {};
+template<typename T> struct PartiallyInstantiatePartialSpec<T*> {
+  static T *foo() { return reinterpret_cast<T*>(0); }
+  static T *bar() { return reinterpret_cast<T*>(0); }
+};
+typedef PartiallyInstantiatePartialSpec<int*> PartiallyInstantiatePartialSpecHelper;

Modified: cfe/trunk/test/Modules/Inputs/cxx-templates-b.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-templates-b.h?rev=214154&r1=214153&r2=214154&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-templates-b.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-templates-b.h Mon Jul 28 19:58:01 2014
@@ -73,4 +73,5 @@ template<typename T> void UseDefinedInBI
 void TriggerInstantiation() {
   UseDefinedInBImpl<void>();
   Std::f<int>();
+  PartiallyInstantiatePartialSpec<int*>::foo();
 }

Modified: cfe/trunk/test/Modules/cxx-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-templates.cpp?rev=214154&r1=214153&r2=214154&view=diff
==============================================================================
--- cfe/trunk/test/Modules/cxx-templates.cpp (original)
+++ cfe/trunk/test/Modules/cxx-templates.cpp Mon Jul 28 19:58:01 2014
@@ -105,6 +105,7 @@ void g() {
 
   int &p = WithPartialSpecializationUse().f();
   int &q = WithExplicitSpecializationUse().inner_template<int>();
+  int *r = PartiallyInstantiatePartialSpec<int*>::bar();
 }
 
 static_assert(Outer<int>::Inner<int>::f() == 1, "");





More information about the cfe-commits mailing list