aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/extern_template-4.C
blob: 9f0c7d720ab66823569d5388301eb945c834de4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/85470
// { dg-do compile { target c++11 } }

template <class T>
struct StaticObject
{
    static T& create()
    {
      static T t;
      return t;
    }

    static T & instance;
};

template <class T> T & StaticObject<T>::instance = StaticObject<T>::create();

extern template class StaticObject<int>;

void test()
{
    StaticObject<int>::instance;
}