1// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -std=c++11 -o - | FileCheck %s
2#include <typeinfo>
3
4namespace Test1 {
5
6struct Item {
7  const std::type_info &ti;
8  const char *name;
9  void *(*make)();
10};
11
12template<typename T> void *make_impl() { return new T; }
13template<typename T> constexpr Item item(const char *name) {
14  return { typeid(T), name, make_impl<T> };
15}
16
17struct A { virtual ~A(); };
18struct B : virtual A {};
19struct C { int n; };
20
21// FIXME: check we produce a constant array for this, once we support IRGen of
22// folded structs and arrays.
23constexpr Item items[] = {
24  item<A>("A"), item<B>("B"), item<C>("C"), item<int>("int")
25};
26
27// CHECK: @_ZN5Test11xE = constant %"class.std::type_info"* bitcast (i8** @_ZTIN5Test11AE to %"class.std::type_info"*), align 8
28constexpr auto &x = items[0].ti;
29
30}
31