diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-10-27 15:00:12 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-10-27 15:00:12 +0000 |
| commit | 969c2a238caec0780f39c148d8b1fd33d1d32ef9 (patch) | |
| tree | 49a40846e8042666c7e10ea22f12022d62b0f5c7 | |
| parent | 995c845e5cb62a522a0addfd1ffac7d02edf5491 (diff) | |
| download | bcm5719-llvm-969c2a238caec0780f39c148d8b1fd33d1d32ef9.tar.gz bcm5719-llvm-969c2a238caec0780f39c148d8b1fd33d1d32ef9.zip | |
Test various aspects of explicit instantiation that were already implemented.
llvm-svn: 85243
| -rw-r--r-- | clang/test/CXX/temp/temp.spec/temp.explicit/p12.cpp | 6 | ||||
| -rw-r--r-- | clang/test/CXX/temp/temp.spec/temp.explicit/p5.cpp | 18 | ||||
| -rw-r--r-- | clang/test/CXX/temp/temp.spec/temp.explicit/p6.cpp | 14 |
3 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.spec/temp.explicit/p12.cpp b/clang/test/CXX/temp/temp.spec/temp.explicit/p12.cpp new file mode 100644 index 00000000000..fdf4393d438 --- /dev/null +++ b/clang/test/CXX/temp/temp.spec/temp.explicit/p12.cpp @@ -0,0 +1,6 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +char* p = 0; +template<class T> T g(T x = &p) { return x; } +template int g<int>(int); // OK even though &p isn’t an int. + diff --git a/clang/test/CXX/temp/temp.spec/temp.explicit/p5.cpp b/clang/test/CXX/temp/temp.spec/temp.explicit/p5.cpp new file mode 100644 index 00000000000..ee756027706 --- /dev/null +++ b/clang/test/CXX/temp/temp.spec/temp.explicit/p5.cpp @@ -0,0 +1,18 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +namespace N { + template<class T> class Y { // expected-note{{explicit instantiation refers here}} + void mf() { } + }; +} + +// FIXME: poor diagnostic +template class Z<int>; // expected-error{{unqualified-id}} + +// FIXME: This example from the standard is wrong; note posted to CWG reflector +// on 10/27/2009 +using N::Y; +template class Y<int>; // expected-error{{must occur in}} + +template class N::Y<char*>; +template void N::Y<double>::mf(); diff --git a/clang/test/CXX/temp/temp.spec/temp.explicit/p6.cpp b/clang/test/CXX/temp/temp.spec/temp.explicit/p6.cpp new file mode 100644 index 00000000000..763d679db7b --- /dev/null +++ b/clang/test/CXX/temp/temp.spec/temp.explicit/p6.cpp @@ -0,0 +1,14 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template<class T> class Array { /* ... */ }; +template<class T> void sort(Array<T>& v) { } + +// instantiate sort(Array<int>&) - template-argument deduced +template void sort<>(Array<int>&); + +template void sort(Array<long>&); + +template<typename T, typename U> void f0(T, U*) { } + +template void f0<int>(int, float*); +template void f0<>(double, float*); |

