]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp
Update clang to r93512.
[FreeBSD/FreeBSD.git] / test / CXX / temp / temp.decls / temp.class / temp.static / p1-inst.cpp
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 // Test instantiation of static data members declared out-of-line.
4
5 template<typename T>
6 struct X {
7   static T value;
8 };
9
10 template<typename T> 
11   T X<T>::value = 17; // expected-error{{no viable conversion}}
12
13 struct InitOkay {
14   InitOkay(int) { }
15 };
16
17 struct CannotInit { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}}
18
19 int &returnInt() { return X<int>::value; }
20 float &returnFloat() { return X<float>::value; }
21
22 InitOkay &returnInitOkay() { return X<InitOkay>::value; }
23
24 unsigned long sizeOkay() { return sizeof(X<CannotInit>::value); }
25   
26 CannotInit &returnError() {
27   return X<CannotInit>::value; // expected-note{{instantiation}}
28 }