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