blob: 083e00144c181a407f28f63711fcf9a52c1e702c [file] [log] [blame]
Douglas Gregorc446d182010-05-05 20:15:55 +00001// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin10.0.0 -o - %s | FileCheck %s
2
3// PR7050
4template<class T> struct X0 : public T { };
5
6template <class T>
7struct X1
8{
9 static T & instance;
10 // include this to provoke instantiation at pre-execution time
11 static void use(T const &) {}
12 static T & get() {
13 static X0<T> t;
14 use(instance);
15 return static_cast<T &>(t);
16 }
17};
18
Stephen Hines6bcf27b2014-05-29 04:14:42 -070019// CHECK: @_ZN2X1I2X2I1BEE8instanceE = linkonce_odr global %struct.X2* null, align 8
20// CHECJ: @_ZN2X1I2X2I1AEE8instanceE = linkonce_odr global %struct.X2* null, align 8
Douglas Gregorc446d182010-05-05 20:15:55 +000021template<class T> T & X1<T>::instance = X1<T>::get();
22
23class A { };
24class B : public A { };
25
26template<typename T> struct X2 {};
27X2< B > bg = X1< X2< B > >::get();
28X2< A > ag = X1< X2< A > >::get();