[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
This commit is contained in:
Richard Smith 2014-07-29 00:58:01 +00:00
parent 08b9515f45
commit 049fcd8c64
3 changed files with 9 additions and 0 deletions

View File

@ -75,3 +75,10 @@ template<typename T> struct MergeTemplateDefinitions {
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;

View File

@ -73,4 +73,5 @@ template<typename T> void UseDefinedInBImplIndirectly(T &v) {
void TriggerInstantiation() {
UseDefinedInBImpl<void>();
Std::f<int>();
PartiallyInstantiatePartialSpec<int*>::foo();
}

View File

@ -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, "");