1@import cxx_templates_common; 2 3template<typename T> T f(); 4template<typename T> T f(T t) { return t; } 5namespace N { 6 template<typename T> T f(); 7 template<typename T> T f(T t) { return t; } 8} 9 10template<typename> int template_param_kinds_1(); 11template<template<typename, int, int...> class> int template_param_kinds_2(); 12template<template<typename T, typename U, U> class> int template_param_kinds_3(); 13 14template<typename T> struct SomeTemplate<T&> {}; 15template<typename T> struct SomeTemplate<T&>; 16typedef SomeTemplate<int&> SomeTemplateIntRef; 17 18extern DefinedInCommon &defined_in_common; 19 20template<int> struct MergeTemplates; 21MergeTemplates<0> *merge_templates_b; 22 23@import cxx_templates_b_impl; 24 25template<typename T, typename> struct Identity { typedef T type; }; 26template<typename T> void UseDefinedInBImpl() { 27 typename Identity<DefinedInBImpl, T>::type dependent; 28 FoundByADL(dependent); 29 typename Identity<DefinedInBImpl, T>::type::Inner inner; 30 dependent.f(); 31} 32 33extern DefinedInBImpl &defined_in_b_impl; 34 35template<typename T> 36struct RedeclareTemplateAsFriend { 37 template<typename U> 38 friend struct RedeclaredAsFriend; 39}; 40 41void use_some_template_b() { 42 SomeTemplate<char[1]> a; 43 SomeTemplate<char[2]> b, c; 44 b = c; 45} 46 47auto enum_b_from_b = CommonTemplate<int>::b; 48const auto enum_c_from_b = CommonTemplate<int>::c; 49 50template<int> struct UseInt; 51template<typename T> void UseRedeclaredEnum(UseInt<T() + CommonTemplate<char>::a>); 52constexpr void (*UseRedeclaredEnumB)(UseInt<1>) = UseRedeclaredEnum<int>; 53 54template<typename> struct MergeSpecializations; 55template<typename T> struct MergeSpecializations<T&> { 56 typedef int partially_specialized_in_b; 57}; 58template<> struct MergeSpecializations<double> { 59 typedef int explicitly_specialized_in_b; 60}; 61 62@import cxx_templates_a; 63template<typename T> void UseDefinedInBImplIndirectly(T &v) { 64 PerformDelayedLookup(v); 65} 66 67void TriggerInstantiation() { 68 UseDefinedInBImpl<void>(); 69 Std::f<int>(); 70} 71