Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | 550d9b2 | 2009-10-31 17:21:17 +0000 | [diff] [blame] | 2 | |
| 3 | // PR5311 |
| 4 | template<typename T> |
| 5 | class StringSwitch { |
| 6 | public: |
| 7 | template<unsigned N> |
| 8 | void Case(const char (&S)[N], const int & Value) { |
| 9 | } |
| 10 | }; |
| 11 | |
Douglas Gregor | c0c8300 | 2010-04-30 21:46:38 +0000 | [diff] [blame] | 12 | void test_stringswitch(int argc, char *argv[]) { |
Douglas Gregor | 550d9b2 | 2009-10-31 17:21:17 +0000 | [diff] [blame] | 13 | (void)StringSwitch<int>(); |
| 14 | } |
Douglas Gregor | c0c8300 | 2010-04-30 21:46:38 +0000 | [diff] [blame] | 15 | |
| 16 | namespace PR6986 { |
| 17 | template<class Class,typename Type,Type Class::*> |
| 18 | struct non_const_member_base |
| 19 | { |
| 20 | }; |
| 21 | |
| 22 | template<class Class,typename Type,Type Class::*PtrToMember> |
| 23 | struct member: non_const_member_base<Class,Type,PtrToMember> |
| 24 | { |
| 25 | }; |
| 26 | |
| 27 | struct test_class |
| 28 | { |
| 29 | int int_member; |
| 30 | }; |
| 31 | typedef member< test_class,const int,&test_class::int_member > ckey_m; |
| 32 | void test() |
| 33 | { |
| 34 | ckey_m m; |
| 35 | } |
| 36 | } |
Douglas Gregor | 8f5667d | 2011-02-18 02:12:44 +0000 | [diff] [blame] | 37 | |
| 38 | namespace rdar8980215 { |
| 39 | enum E { E1, E2, E3 }; |
| 40 | |
| 41 | template<typename T, E e = E2> |
| 42 | struct X0 { |
| 43 | X0() {} |
| 44 | template<typename U> X0(const X0<U, e> &); |
| 45 | }; |
| 46 | |
| 47 | template<typename T> |
| 48 | struct X1 : X0<T> { |
| 49 | X1() {} |
| 50 | template<typename U> X1(const X1<U> &x) : X0<T>(x) { } |
| 51 | }; |
| 52 | |
| 53 | X1<int> x1i; |
| 54 | X1<float> x1f(x1i); |
| 55 | } |