diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-07-22 20:02:25 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-07-22 20:02:25 +0000 |
| commit | 60454827929a764cb31fef5aa27c4c7d0a581e7e (patch) | |
| tree | db017bff773d7208f974a2bfb6edfbeaee6c1675 /clang/test/SemaTemplate | |
| parent | af6ab88979408e723611d880cf14e975ab96248e (diff) | |
| download | bcm5719-llvm-60454827929a764cb31fef5aa27c4c7d0a581e7e.tar.gz bcm5719-llvm-60454827929a764cb31fef5aa27c4c7d0a581e7e.zip | |
Improve template argument deduction for array types, so that a parameter
const T
can be matched with, e.g.,
volatile int [5]
llvm-svn: 76773
Diffstat (limited to 'clang/test/SemaTemplate')
| -rw-r--r-- | clang/test/SemaTemplate/temp_class_spec.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/temp_class_spec.cpp b/clang/test/SemaTemplate/temp_class_spec.cpp index 1a534236c8e..da343507179 100644 --- a/clang/test/SemaTemplate/temp_class_spec.cpp +++ b/clang/test/SemaTemplate/temp_class_spec.cpp @@ -32,6 +32,35 @@ struct is_lvalue_reference<T&> { int lvalue_ref0[is_lvalue_reference<int>::value? -1 : 1]; int lvalue_ref1[is_lvalue_reference<const int&>::value? 1 : -1]; +template<typename T> +struct is_const { + static const bool value = false; +}; + +template<typename T> +struct is_const<const T> { + static const bool value = true; +}; + +int is_const0[is_const<int>::value? -1 : 1]; +int is_const1[is_const<const int>::value? 1 : -1]; +int is_const2[is_const<const volatile int>::value? 1 : -1]; + +template<typename T> +struct is_volatile { + static const bool value = false; +}; + +template<typename T> +struct is_volatile<volatile T> { + static const bool value = true; +}; + +int is_volatile0[is_volatile<int>::value? -1 : 1]; +int is_volatile1[is_volatile<volatile int>::value? 1 : -1]; +int is_volatile2[is_volatile<const volatile int>::value? 1 : -1]; +int is_volatile3[is_volatile<volatile char[3]>::value? 1 : -1]; + template<typename T, typename U> struct is_same { static const bool value = false; |

