From b7ae10f764baceba4c890fa44ef14b71822ebd85 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 5 Jun 2009 00:53:49 +0000 Subject: Several improvements to template argument deduction: - Once we have deduced template arguments for a class template partial specialization, we use exactly those template arguments for instantiating the definition of the class template partial specialization. - Added template argument deduction for non-type template parameters. - Added template argument deduction for dependently-sized array types. With these changes, we can now implement, e.g., the remove_reference type trait. Also, Daniel's Ackermann template metaprogram now compiles properly. llvm-svn: 72909 --- clang/test/SemaTemplate/temp_class_spec.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'clang/test/SemaTemplate/temp_class_spec.cpp') diff --git a/clang/test/SemaTemplate/temp_class_spec.cpp b/clang/test/SemaTemplate/temp_class_spec.cpp index d516f01d7fd..8cb46cf98f8 100644 --- a/clang/test/SemaTemplate/temp_class_spec.cpp +++ b/clang/test/SemaTemplate/temp_class_spec.cpp @@ -50,6 +50,19 @@ int is_same1[is_same::value? 1 : -1]; int is_same2[is_same::value? -1 : 1]; int is_same3[is_same::value? -1 : 1]; +template +struct remove_reference { + typedef T type; +}; + +template +struct remove_reference { + typedef T type; +}; + +int remove_ref0[is_same::type, int>::value? 1 : -1]; +int remove_ref1[is_same::type, int>::value? 1 : -1]; + template struct is_incomplete_array { static const bool value = false; @@ -79,3 +92,13 @@ int array_with_4_elements0[is_array_with_4_elements::value ? -1 : 1]; int array_with_4_elements1[is_array_with_4_elements::value ? -1 : 1]; int array_with_4_elements2[is_array_with_4_elements::value ? 1 : -1]; int array_with_4_elements3[is_array_with_4_elements::value ? 1 : -1]; + +template +struct get_array_size; + +template +struct get_array_size { + static const unsigned value = N; +}; + +int array_size0[get_array_size::value == 12? 1 : -1]; -- cgit v1.2.3