Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 1 | @import cxx_templates_common; |
| 2 | |
Richard Smith | 8f8f05c | 2013-06-24 04:45:28 +0000 | [diff] [blame] | 3 | template<typename T> T f() { return T(); } |
| 4 | template<typename T> T f(T); |
| 5 | namespace N { |
| 6 | template<typename T> T f() { return T(); } |
| 7 | template<typename T> T f(T); |
| 8 | } |
Richard Smith | bf78e64 | 2013-06-24 22:51:00 +0000 | [diff] [blame] | 9 | |
| 10 | template<int N> int template_param_kinds_1(); |
| 11 | template<template<typename T, int, int> class> int template_param_kinds_2(); |
| 12 | template<template<typename T, typename U, T> class> int template_param_kinds_3(); |
Richard Smith | 5de91b5 | 2013-06-25 01:25:15 +0000 | [diff] [blame] | 13 | |
| 14 | template<typename T> struct SomeTemplate<T*>; |
| 15 | template<typename T> struct SomeTemplate<T*> {}; |
| 16 | typedef SomeTemplate<int*> SomeTemplateIntPtr; |
Richard Smith | 0e5d7b8 | 2013-07-25 23:08:39 +0000 | [diff] [blame] | 17 | |
| 18 | template<typename T> void PerformDelayedLookup(T &t) { |
| 19 | t.f(); |
| 20 | typename T::Inner inner; |
| 21 | FoundByADL(t); |
| 22 | } |
Richard Smith | b71782b | 2013-08-01 04:12:04 +0000 | [diff] [blame] | 23 | |
| 24 | template<typename T> void PerformDelayedLookupInDefaultArgument(T &t, int a = (FoundByADL(T()), 0)) {} |
Richard Smith | 7ecc31b | 2013-08-02 01:09:12 +0000 | [diff] [blame] | 25 | |
| 26 | template<typename T> struct RedeclaredAsFriend {}; |
Richard Smith | d55889a | 2013-09-09 16:55:27 +0000 | [diff] [blame] | 27 | |
| 28 | void use_some_template_a() { |
| 29 | SomeTemplate<char[2]> a; |
| 30 | SomeTemplate<char[1]> b, c; |
| 31 | b = c; |
| 32 | } |
Richard Smith | d46d6de | 2013-10-13 23:50:45 +0000 | [diff] [blame] | 33 | |
| 34 | template<int> struct MergeTemplates; |
| 35 | MergeTemplates<0> *merge_templates_a; |
Richard Smith | 01a7337 | 2013-10-15 22:02:41 +0000 | [diff] [blame^] | 36 | |
| 37 | auto enum_a_from_a = CommonTemplate<int>::a; |
| 38 | const auto enum_c_from_a = CommonTemplate<int>::c; |
| 39 | |
| 40 | template<int> struct UseInt; |
| 41 | template<typename T> void UseRedeclaredEnum(UseInt<T() + CommonTemplate<char>::a>); |
| 42 | constexpr void (*UseRedeclaredEnumA)(UseInt<1>) = UseRedeclaredEnum<int>; |