1176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines// RUN: %clang_cc1 -fsyntax-only -Wunused-local-typedef -verify -std=c++1y %s
2176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
3176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesstruct S {
4176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int Foo;  // no diag
5176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines};
6176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
7176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesnamespace N {
8176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int Foo;  // no diag
9176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int Foo2;  // no diag
10176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
11176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
12176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinestemplate <class T> class Vec {};
13176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
14176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinestypedef int global_foo;  // no diag
15176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
16176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid f() {
17176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int foo0;  // expected-warning {{unused typedef 'foo0'}}
18176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  using foo0alias = int ;  // expected-warning {{unused type alias 'foo0alias'}}
19176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
20176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int foo1 __attribute__((unused));  // no diag
21176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
22176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int foo2;
23176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  {
24176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int foo2;  // expected-warning {{unused typedef 'foo2'}}
25176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  }
26176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef foo2 foo3; // expected-warning {{unused typedef 'foo3'}}
27176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
28176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int foo2_2;  // expected-warning {{unused typedef 'foo2_2'}}
29176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  {
30176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int foo2_2;
31176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef foo2_2 foo3_2; // expected-warning {{unused typedef 'foo3_2'}}
32176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  }
33176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
34176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int foo4;
35176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  foo4 the_thing;
36176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
37176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int* foo5;
38176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef foo5* foo6;  // no diag
39176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  foo6 *myptr;
40176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
41176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S2 {
42176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Foo; // no diag
43176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Foo2; // expected-warning {{unused typedef 'Foo2'}}
44176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
45176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    struct Deeper {
46176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines      typedef int DeepFoo;  // expected-warning {{unused typedef 'DeepFoo'}}
47176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    };
48176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
49176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
50176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  S2::Foo s2foo;
51176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
52176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef struct {} foostruct; // expected-warning {{unused typedef 'foostruct'}}
53176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
54176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef struct {} foostruct2; // no diag
55176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  foostruct2 fs2;
56176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
57176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int vecint;  // no diag
58176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  Vec<vecint> v;
59176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
60176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  N::Foo nfoo;
61176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
62176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int ConstExprInt;
63176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  static constexpr int a = (ConstExprInt)4;
64176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
65176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
66176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesint printf(char const *, ...);
67176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
68176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid test() {
69176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef signed long int superint; // no diag
70176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  printf("%f", (superint) 42);
71176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
72176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef signed long int superint2; // no diag
73176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  printf("%f", static_cast<superint2>(42));
74176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
75176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines#pragma clang diagnostic push
76176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines#pragma clang diagnostic ignored "-Wunused-local-typedef"
77176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int trungl_bot_was_here; // no diag
78176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines#pragma clang diagnostic pop
79176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
80176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int foo; // expected-warning {{unused typedef 'foo'}}
81176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
82176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
83176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinestemplate <class T>
84176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid template_fun(T t) {
85176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int foo; // expected-warning {{unused typedef 'foo'}}
86176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef int bar; // no-diag
87176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  bar asdf;
88176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
89176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S2 {
90176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Foo; // no diag
91176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
92176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Foo2; // expected-warning {{unused typedef 'Foo2'}}
93176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
94176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Foo3; // no diag
95176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
96176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
97176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typename S2::Foo s2foo;
98176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typename T::Foo s3foo;
99176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
100176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef typename S2::Foo3 TTSF;  // expected-warning {{unused typedef 'TTSF'}}
101176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
102176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid template_fun_user() {
103176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct Local {
104176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Foo; // no-diag
105176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Bar; // expected-warning {{unused typedef 'Bar'}}
106176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  } p;
107176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  template_fun(p);
108176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
109176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
110176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid typedef_in_nested_name() {
111176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef struct {
112176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Foo;
113176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  } A;
114176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  A::Foo adsf;
115176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
116176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  using A2 = struct {
117176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int Foo;
118176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
119176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  A2::Foo adsf2;
120176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
121176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
122176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto sneaky() {
123176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S {
124176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    // Local typedefs can be used after the scope they were in has closed:
125176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int t;
126176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
127176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    // Even if they aren't, this could be an inline function that could be used
128176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    // in another TU, so this shouldn't warn either:
129176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int s;
130176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
131176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  private:
132176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int p; // expected-warning{{unused typedef 'p'}}
133176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
134176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return S();
135176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
136176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto x = sneaky();
137176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesdecltype(x)::t y;
138176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
139176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesstatic auto static_sneaky() {
140176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S {
141176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int t;
142176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    // This function has internal linkage, so we can warn:
143176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int s; // expected-warning {{unused typedef 's'}}
144176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
145176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return S();
146176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
147176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto sx = static_sneaky();
148176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesdecltype(sx)::t sy;
149176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
150176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto sneaky_with_friends() {
151176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S {
152176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  private:
153176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    friend class G;
154176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    // Can't warn if we have friends:
155176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int p;
156176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
157176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return S();
158176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
159176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
160176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesnamespace {
161176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto nstatic_sneaky() {
162176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S {
163176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int t;
164176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    // This function has internal linkage, so we can warn:
165176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int s; // expected-warning {{unused typedef 's'}}
166176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
167176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return S();
168176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
169176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto nsx = nstatic_sneaky();
170176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesdecltype(nsx)::t nsy;
171176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
172176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
173176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines// Like sneaky(), but returning pointer to local type
174176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinestemplate<typename T>
175176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesstruct remove_reference { typedef T type; };
176176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinestemplate<typename T> struct remove_reference<T&> { typedef T type; };
177176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto pointer_sneaky() {
178176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S {
179176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int t;
180176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int s;
181176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
182176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return (S*)nullptr;
183176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
184176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesremove_reference<decltype(*pointer_sneaky())>::type::t py;
185176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
186176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines// Like sneaky(), but returning templated struct referencing local type.
187176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinestemplate <class T> struct container { int a; T t; };
188176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto template_sneaky() {
189176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S {
190176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int t;
191176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int s;
192176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
193176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return container<S>();
194176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
195176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto tx = template_sneaky();
196176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesdecltype(tx.t)::t ty;
197176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
198176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines// Like sneaky(), but doing its sneakiness by returning a member function
199176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines// pointer.
200176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesauto sneaky_memfun() {
201176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct S {
202176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef int type;
203176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    int n;
204176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
205176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  return &S::n;
206176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
207176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
208176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinestemplate <class T> void sneaky_memfun_g(int T::*p) {
209176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typename T::type X;
210176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
211176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
212176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid sneaky_memfun_h() {
213176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  sneaky_memfun_g(sneaky_memfun());
214176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
215176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
216176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid typedefs_in_constructors() {
217176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct A {};
218176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct B : public A {
219176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    // Neither of these two should warn:
220176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef A INHERITED;
221176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    B() : INHERITED() {}
222176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
223176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    typedef B SELF;
224176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines    B(int) : SELF() {}
225176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  };
226176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
227176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
228176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid *operator new(__SIZE_TYPE__, void *p) throw() { return p; }
229176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hinesvoid placement_new_and_delete() {
230176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  struct MyStruct { };
231176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  char memory[sizeof(MyStruct)];
232176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  void *p = memory;
233176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
234176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef MyStruct A_t1;
235176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  MyStruct *a = new (p) A_t1();
236176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
237176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  typedef MyStruct A_t2;
238176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines  a->~A_t2();
239176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines}
240176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines
241176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines// This should not disable any warnings:
242176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines#pragma clang diagnostic ignored "-Wunused-local-typedef"
243