Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/extern_template-4.C

raw
1 // PR c++/85470
2 // { dg-do compile { target c++11 } }
3
4 template <class T>
5 struct StaticObject
6 {
7 static T& create()
8 {
9 static T t;
10 return t;
11 }
12
13 static T & instance;
14 };
15
16 template <class T> T & StaticObject<T>::instance = StaticObject<T>::create();
17
18 extern template class StaticObject<int>;
19
20 void test()
21 {
22 StaticObject<int>::instance;
23 }