Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Modules / Inputs / cxx-templates-b.h
blobd763c8040ba3d1e81118b6be68ecce76039da270
1 @import cxx_templates_common;
3 template<typename T> T f();
4 template<typename T> T f(T t) { return t; }
5 namespace N {
6 template<typename T> T f();
7 template<typename T> T f(T t) { return t; }
10 template<typename> int template_param_kinds_1();
11 template<template<typename, int, int...> class> int template_param_kinds_2();
12 template<template<typename T, typename U, U> class> int template_param_kinds_3();
14 template<typename T> struct SomeTemplate<T&> {};
15 template<typename T> struct SomeTemplate<T&>;
16 typedef SomeTemplate<int&> SomeTemplateIntRef;
18 extern DefinedInCommon &defined_in_common;
20 template<int> struct MergeTemplates;
21 MergeTemplates<0> *merge_templates_b;
23 template<typename T> template<typename U>
24 constexpr int Outer<T>::Inner<U>::g() { return 2; }
25 static_assert(Outer<int>::Inner<int>::g() == 2, "");
27 namespace TestInjectedClassName {
28 template<typename T> struct X { X(); };
29 typedef X<char[2]> B;
32 @import cxx_templates_b_impl;
34 template<typename T, typename> struct Identity { typedef T type; };
35 template<typename T> void UseDefinedInBImpl() {
36 typename Identity<DefinedInBImpl, T>::type dependent;
37 FoundByADL(dependent);
38 typename Identity<DefinedInBImpl, T>::type::Inner inner;
39 dependent.f();
42 extern DefinedInBImpl &defined_in_b_impl;
44 template<typename T>
45 struct RedeclareTemplateAsFriend {
46 template<typename U>
47 friend struct RedeclaredAsFriend;
50 void use_some_template_b() {
51 SomeTemplate<char[1]> a;
52 SomeTemplate<char[2]> b, c;
53 b = c;
55 WithImplicitSpecialMembers<int> wism1, wism2(wism1);
58 auto enum_b_from_b = CommonTemplate<int>::b;
59 const auto enum_c_from_b = CommonTemplate<int>::c;
61 template<int> struct UseInt;
62 template<typename T> void UseRedeclaredEnum(UseInt<T() + CommonTemplate<char>::a>);
63 constexpr void (*UseRedeclaredEnumB)(UseInt<1>) = UseRedeclaredEnum<int>;
65 typedef WithPartialSpecialization<void(int)>::type WithPartialSpecializationInstantiate3;
67 template<typename> struct MergeSpecializations;
68 template<typename T> struct MergeSpecializations<T&> {
69 typedef int partially_specialized_in_b;
71 template<> struct MergeSpecializations<double> {
72 typedef int explicitly_specialized_in_b;
75 template<typename U> using AliasTemplate = U;
77 void InstantiateWithAliasTemplate(WithAliasTemplate<int>::X<char>);
78 inline int InstantiateWithAnonymousDeclsB(WithAnonymousDecls<int> x) {
79 return (x.k ? x.a : x.b) + (x.k ? x.s.c : x.s.d) + x.e;
81 inline int InstantiateWithAnonymousDeclsB2(WithAnonymousDecls<char> x) {
82 return (x.k ? x.a : x.b) + (x.k ? x.s.c : x.s.d) + x.e;
85 @import cxx_templates_a;
86 template<typename T> void UseDefinedInBImplIndirectly(T &v) {
87 PerformDelayedLookup(v);
90 void TriggerInstantiation() {
91 UseDefinedInBImpl<void>();
92 Std::f<int>();
93 PartiallyInstantiatePartialSpec<int*>::foo();
94 WithPartialSpecialization<void(int)>::type x;