Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Modules / Inputs / submodules-merge-defs / defs.h
blobf6004f0fc8b239e0766e6f8db8eec21f21869e52
1 struct A { int a_member; };
2 inline int use_a(A a) { return a.a_member; }
4 class B {
5 struct Inner1 {};
6 public:
7 struct Inner2;
8 struct Inner3;
9 template<typename T> void f();
11 struct BFriend {
12 friend class B::Inner3;
13 private:
14 struct Inner3Base {};
16 // Check that lookup and access checks are performed in the right context.
17 struct B::Inner2 : Inner1 {};
18 struct B::Inner3 : BFriend::Inner3Base {};
19 template<typename T> void B::f() {}
20 template<> inline void B::f<int>() {}
22 // Check that base-specifiers are correctly disambiguated.
23 template<int N> struct C_Base { struct D { constexpr operator int() const { return 0; } }; };
24 const int C_Const = 0;
25 struct C1 : C_Base<C_Base<0>::D{}> {} extern c1;
26 struct C2 : C_Base<C_Const<0>::D{} extern c2;
28 typedef struct { int a; void f(); struct X; } D;
29 struct D::X { int dx; } extern dx;
30 inline int use_dx(D::X dx) { return dx.dx; }
32 template<typename T> int E(T t) { return t; }
34 template<typename T> struct F {
35 int f();
36 template<typename U> int g();
37 static int n;
39 template<typename T> int F<T>::f() { return 0; }
40 template<typename T> template<typename U> int F<T>::g() { return 0; }
41 template<typename T> int F<T>::n = 0;
42 template<> inline int F<char>::f() { return 0; }
43 template<> template<typename U> int F<char>::g() { return 0; }
44 template<> struct F<void> { int h(); };
45 inline int F<void>::h() { return 0; }
46 template<typename T> struct F<T *> { int i(); };
47 template<typename T> int F<T*>::i() { return 0; }
49 namespace G {
50 enum A { a, b, c, d, e };
51 enum { f, g, h };
52 typedef enum { i, j } k;
53 typedef enum {} l;
56 template<typename T = int, int N = 3, template<typename> class K = F> int H(int a = 1);
57 template<typename T = int, int N = 3, template<typename> class K = F> using I = decltype(H<T, N, K>());
58 template<typename T = int, int N = 3, template<typename> class K = F> struct J {};
60 namespace NS {
61 struct A {};
62 template<typename T> struct B : A {};
63 template<typename T> struct B<T*> : B<char> {};
64 template<> struct B<int> : B<int*> {};
65 inline void f() {}
68 namespace StaticInline {
69 struct X {};
70 static inline void f(X);
71 static inline void g(X x) { f(x); }
74 namespace FriendDefArg {
75 template<typename = int> struct A;
76 template<int = 0> struct B;
77 template<template<typename> class = A> struct C;
78 template<typename = int, int = 0, template<typename> class = A> struct D {};
79 template<typename U> struct Y {
80 template<typename> friend struct A;
81 template<int> friend struct B;
82 template<template<typename> class> friend struct C;
83 template<typename, int, template<typename> class> friend struct D;
87 namespace SeparateInline {
88 inline void f();
89 void f() {}
90 constexpr int g() { return 0; }
93 namespace TrailingAttributes {
94 template<typename T> struct X {} __attribute__((aligned(8)));
97 namespace MergeFunctionTemplateSpecializations {
98 template<typename T> T f();
99 template<typename T> struct X {
100 template<typename U> using Q = decltype(f<T>() + U());
102 using xiq = X<int>::Q<int>;
105 enum ScopedEnum : int;
106 enum ScopedEnum : int { a, b, c };
108 namespace RedeclDifferentDeclKind {
109 struct X {};
110 typedef X X;
111 using RedeclDifferentDeclKind::X;
114 namespace Anon {
115 struct X {
116 union {
117 int n;
122 namespace ClassTemplatePartialSpec {
123 template<typename T> struct F;
124 template<template<int> class A, int B> struct F<A<B>> {
125 template<typename C> F();
127 template<template<int> class A, int B> template<typename C> F<A<B>>::F() {}
129 template<typename A, int B> struct F<A[B]> {
130 template<typename C> F();
132 template<typename A, int B> template<typename C> F<A[B]>::F() {}
135 struct MemberClassTemplate {
136 template<typename T> struct A;
138 template<typename T> struct MemberClassTemplate::A {};
139 template<typename T> struct MemberClassTemplate::A<T*> {};
140 template<> struct MemberClassTemplate::A<int> {};