blob: 6add18c19081186fd3811918a0447f67a8dd6300 [file] [log] [blame]
Anna Zaks45246a72012-05-14 22:38:24 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core -fblocks -verify %s
2
3// Do not crash on this templated code which uses a block.
4typedef void (^my_block)(void);
5static void useBlock(my_block block){}
6template<class T> class MyClass;
7typedef MyClass<float> Mf;
8
9template<class T>
10class MyClass
11{
12public:
13 MyClass() {}
14 MyClass(T a);
15 void I();
16private:
17 static const T one;
18};
19
20template<class T> const T MyClass<T>::one = static_cast<T>(1);
21template<class T> inline MyClass<T>::MyClass(T a){}
22template<class T> void MyClass<T>::I() {
23 static MyClass<T>* mPtr = 0;
24 useBlock(^{ mPtr = new MyClass<T> (MyClass<T>::one); });
25};
26int main(){
27 Mf m;
28 m.I();
29}