John McCall | c000834 | 2010-05-13 07:48:05 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | @class NSString; |
| 4 | |
| 5 | // Reduced from WebKit. |
| 6 | namespace test0 { |
| 7 | template <typename T> struct RemovePointer { |
| 8 | typedef T Type; |
| 9 | }; |
| 10 | |
| 11 | template <typename T> struct RemovePointer<T*> { |
| 12 | typedef T Type; |
| 13 | }; |
| 14 | |
| 15 | template <typename T> struct RetainPtr { |
| 16 | typedef typename RemovePointer<T>::Type ValueType; |
| 17 | typedef ValueType* PtrType; |
| 18 | RetainPtr(PtrType ptr); |
| 19 | }; |
| 20 | |
| 21 | void test(NSString *S) { |
| 22 | RetainPtr<NSString*> ptr(S); |
| 23 | } |
John McCall | 5d7c29a | 2010-05-13 08:39:13 +0000 | [diff] [blame] | 24 | |
| 25 | void test(id S) { |
| 26 | RetainPtr<id> ptr(S); |
| 27 | } |
John McCall | c000834 | 2010-05-13 07:48:05 +0000 | [diff] [blame] | 28 | } |