diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-31 18:38:02 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-31 18:38:02 +0000 |
commit | aa59489b18f2520264e6427cda4caf440d6b00b3 (patch) | |
tree | c5dad7d0e8e9e86874fb4b38ac0f0d88e0b50a37 /clang/test/SemaTemplate/metafun-apply.cpp | |
parent | eccc5967bfdfd2fed96c34f52ec2e346a072dc48 (diff) | |
download | bcm5719-llvm-aa59489b18f2520264e6427cda4caf440d6b00b3.tar.gz bcm5719-llvm-aa59489b18f2520264e6427cda4caf440d6b00b3.zip |
Implement template instantiation for template names, including both
template template parameters and dependent template names. For
example, the oft-mentioned
typename MetaFun::template apply<T1, T2>::type
can now be instantiated, with the appropriate name lookup for "apply".
llvm-svn: 68128
Diffstat (limited to 'clang/test/SemaTemplate/metafun-apply.cpp')
-rw-r--r-- | clang/test/SemaTemplate/metafun-apply.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/clang/test/SemaTemplate/metafun-apply.cpp b/clang/test/SemaTemplate/metafun-apply.cpp index 22be5ab34f7..e81d1421ebe 100644 --- a/clang/test/SemaTemplate/metafun-apply.cpp +++ b/clang/test/SemaTemplate/metafun-apply.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: clang-cc -fsyntax-only -verify %s struct add_pointer { template<typename T> @@ -10,20 +10,21 @@ struct add_pointer { struct add_reference { template<typename T> struct apply { - typedef T& type; + typedef T& type; // expected-error{{cannot form a reference to 'void'}} }; }; template<typename MetaFun, typename T> struct apply1 { - typedef typename MetaFun::template apply<T>::type type; + typedef typename MetaFun::template apply<T>::type type; // expected-note{{in instantiation of template class 'struct add_reference::apply<void>' requested here}} }; -#if 0 -// FIXME: The code below requires template instantiation for dependent -// template-names that occur within nested-name-specifiers. int i; - apply1<add_pointer, int>::type ip = &i; apply1<add_reference, int>::type ir = i; -#endif +apply1<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a value of type 'int'}} + +void test() { + apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}} \ + // FIXME: expected-error{{unexpected type name 'type': expected expression}} +} |