Douglas Gregor | c50d492 | 2012-12-11 22:11:52 +0000 | [diff] [blame] | 1 | @import templates_top; |
Axel Naumann | 63469422c | 2012-10-02 09:09:43 +0000 | [diff] [blame] | 2 | |
| 3 | template<typename T> class Vector; |
| 4 | |
| 5 | template<typename T> class Vector; |
| 6 | |
| 7 | template<typename T> class List; |
| 8 | template<> class List<bool> { |
| 9 | public: |
| 10 | void push_back(int); |
| 11 | }; |
| 12 | namespace N { |
| 13 | template<typename T> class Set; |
| 14 | } |
| 15 | namespace N { |
| 16 | template<typename T> class Set { |
| 17 | public: |
| 18 | void insert(T); |
| 19 | }; |
| 20 | } |
| 21 | |
Richard Smith | 0b87e07 | 2013-10-07 08:02:11 +0000 | [diff] [blame] | 22 | constexpr unsigned List<int>::*size_left = &List<int>::size; |
| 23 | List<int> list_left = { 0, 8 }; |
| 24 | typedef List<int> ListInt_left; |
| 25 | |
Axel Naumann | 63469422c | 2012-10-02 09:09:43 +0000 | [diff] [blame] | 26 | template <typename T> |
Axel Naumann | d9a25b3 | 2012-10-02 12:18:46 +0000 | [diff] [blame] | 27 | void pendingInstantiationEmit(T) {} |
Axel Naumann | 63469422c | 2012-10-02 09:09:43 +0000 | [diff] [blame] | 28 | void triggerPendingInstantiation() { |
Axel Naumann | d9a25b3 | 2012-10-02 12:18:46 +0000 | [diff] [blame] | 29 | pendingInstantiationEmit(12); |
| 30 | pendingInstantiationEmit(42.); |
Axel Naumann | 63469422c | 2012-10-02 09:09:43 +0000 | [diff] [blame] | 31 | } |
Axel Naumann | d9a25b3 | 2012-10-02 12:18:46 +0000 | [diff] [blame] | 32 | |
| 33 | void redeclDefinitionEmit(){} |
Richard Smith | d55889a | 2013-09-09 16:55:27 +0000 | [diff] [blame] | 34 | |
| 35 | typedef Outer<int>::Inner OuterIntInner_left; |
Richard Smith | cd45dbc | 2014-04-19 03:48:30 +0000 | [diff] [blame] | 36 | |
| 37 | int defineListDoubleLeft() { |
| 38 | List<double> ld; |
| 39 | ld.push_back(0.0); |
| 40 | return ld.size; |
| 41 | } |
Richard Smith | f17fdbd | 2014-04-24 02:25:27 +0000 | [diff] [blame] | 42 | |
| 43 | template<typename T> struct MergePatternDecl; |
Richard Smith | eb36ddf | 2014-04-24 22:45:46 +0000 | [diff] [blame] | 44 | |
| 45 | extern template struct ExplicitInstantiation<false, false>; |
| 46 | extern template struct ExplicitInstantiation<false, true>; |
| 47 | extern template struct ExplicitInstantiation<true, false>; |
| 48 | extern template struct ExplicitInstantiation<true, true>; |
| 49 | |
| 50 | void useExplicitInstantiation() { |
| 51 | ExplicitInstantiation<true, false>().f(); |
| 52 | ExplicitInstantiation<true, true>().f(); |
| 53 | } |
Richard Smith | d1c4674 | 2014-04-30 02:24:17 +0000 | [diff] [blame] | 54 | |
| 55 | template<typename> struct DelayUpdates; |
| 56 | template<> struct DelayUpdates<int>; |
| 57 | template<typename T> struct DelayUpdates<T*>; |
| 58 | template<typename T> void testDelayUpdates(DelayUpdates<T> *p = 0) {} |
Richard Smith | 195d8ef | 2014-05-29 03:15:31 +0000 | [diff] [blame] | 59 | |
| 60 | void outOfLineInlineUseLeftF(void (OutOfLineInline<int>::*)() = &OutOfLineInline<int>::f); |
| 61 | void outOfLineInlineUseLeftG(void (OutOfLineInline<int>::*)() = &OutOfLineInline<int>::g); |
| 62 | void outOfLineInlineUseLeftH(void (OutOfLineInline<int>::*)() = &OutOfLineInline<int>::h); |
Richard Smith | 462b6fc | 2014-08-14 20:30:52 +0000 | [diff] [blame] | 63 | |
| 64 | namespace EmitDefaultedSpecialMembers { |
| 65 | inline void f() { |
| 66 | SmallString<256> SS; |
| 67 | }; |
| 68 | } |
Richard Smith | 73b21d8 | 2014-09-03 02:33:22 +0000 | [diff] [blame] | 69 | |
| 70 | inline int *getStaticDataMemberLeft() { |
| 71 | return WithUndefinedStaticDataMember<int[]>::undefined; |
| 72 | } |
Richard Smith | 842e46e | 2016-10-26 02:31:56 +0000 | [diff] [blame] | 73 | |
| 74 | inline WithAttributes<int> make_with_attributes_left() { return WithAttributes<int>(); } |