Home | History | Annotate | Download | only in Inputs
      1 @import cxx_templates_common;
      2 
      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 }
      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();
     13 
     14 template<typename T> struct SomeTemplate<T*>;
     15 template<typename T> struct SomeTemplate<T*> {};
     16 typedef SomeTemplate<int*> SomeTemplateIntPtr;
     17 
     18 template<typename T> void PerformDelayedLookup(T &t) {
     19   t.f();
     20   typename T::Inner inner;
     21   FoundByADL(t);
     22 }
     23 
     24 template<typename T> void PerformDelayedLookupInDefaultArgument(T &t, int a = (FoundByADL(T()), 0)) {}
     25 
     26 template<typename T> struct RedeclaredAsFriend {};
     27 
     28 void use_some_template_a() {
     29   SomeTemplate<char[2]> a;
     30   SomeTemplate<char[1]> b, c;
     31   b = c;
     32 }
     33 
     34 template<int> struct MergeTemplates;
     35 MergeTemplates<0> *merge_templates_a;
     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>;
     43 
     44 template<typename> struct MergeSpecializations;
     45 template<typename T> struct MergeSpecializations<T*> {
     46   typedef int partially_specialized_in_a;
     47 };
     48 template<> struct MergeSpecializations<char> {
     49   typedef int explicitly_specialized_in_a;
     50 };
     51 
     52 void InstantiateWithFriend(Std::WithFriend<int> wfi) {}
     53 
     54 template<typename T> struct WithPartialSpecialization<T*> {
     55   typedef int type;
     56   T &f() { static T t; return t; }
     57 };
     58 typedef WithPartialSpecializationUse::type WithPartialSpecializationInstantiate;
     59 
     60 template<> struct WithExplicitSpecialization<int> {
     61   int n;
     62   template<typename T> T &inner_template() {
     63     return n;
     64   }
     65 };
     66