File: cxx-templates-a.h

package info (click to toggle)
llvm-toolchain-3.5 1%3A3.5.2-3~bpo8%2B2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 283,276 kB
  • sloc: cpp: 1,884,580; ansic: 310,787; objc: 86,612; python: 79,608; asm: 65,866; sh: 9,829; makefile: 6,068; perl: 5,589; ml: 5,254; pascal: 3,285; lisp: 1,640; xml: 686; cs: 239; csh: 117
file content (75 lines) | stat: -rw-r--r-- 2,242 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@import cxx_templates_common;

template<typename T> T f() { return T(); }
template<typename T> T f(T);
namespace N {
  template<typename T> T f() { return T(); }
  template<typename T> T f(T);
}

template<int N> int template_param_kinds_1();
template<template<typename T, int, int> class> int template_param_kinds_2();
template<template<typename T, typename U, T> class> int template_param_kinds_3();

template<typename T> struct SomeTemplate<T*>;
template<typename T> struct SomeTemplate<T*> {};
typedef SomeTemplate<int*> SomeTemplateIntPtr;

template<typename T> void PerformDelayedLookup(T &t) {
  t.f();
  typename T::Inner inner;
  FoundByADL(t);
}

template<typename T> void PerformDelayedLookupInDefaultArgument(T &t, int a = (FoundByADL(T()), 0)) {}

template<typename T> struct RedeclaredAsFriend {};

void use_some_template_a() {
  SomeTemplate<char[2]> a;
  SomeTemplate<char[1]> b, c;
  b = c;
}

template<int> struct MergeTemplates;
MergeTemplates<0> *merge_templates_a;

auto enum_a_from_a = CommonTemplate<int>::a;
const auto enum_c_from_a = CommonTemplate<int>::c;

template<int> struct UseInt;
template<typename T> void UseRedeclaredEnum(UseInt<T() + CommonTemplate<char>::a>);
constexpr void (*UseRedeclaredEnumA)(UseInt<1>) = UseRedeclaredEnum<int>;

template<typename> struct MergeSpecializations;
template<typename T> struct MergeSpecializations<T*> {
  typedef int partially_specialized_in_a;
};
template<> struct MergeSpecializations<char> {
  typedef int explicitly_specialized_in_a;
};

void InstantiateWithFriend(Std::WithFriend<int> wfi) {}

template<typename T> struct WithPartialSpecialization<T*> {
  typedef int type;
  T &f() { static T t; return t; }
};
typedef WithPartialSpecializationUse::type WithPartialSpecializationInstantiate;

template<> struct WithExplicitSpecialization<int> {
  int n;
  template<typename T> T &inner_template() {
    return n;
  }
};

template<typename T> template<typename U>
constexpr int Outer<T>::Inner<U>::f() { return 1; }
static_assert(Outer<int>::Inner<int>::f() == 1, "");

template<typename T> struct MergeTemplateDefinitions {
  static constexpr int f();
  static constexpr int g();
};
template<typename T> constexpr int MergeTemplateDefinitions<T>::f() { return 1; }