1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -fblocks -verify -analyzer-config eagerly-assume=false %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -fblocks -analyzer-config c++-template-inlining=false -DNO_INLINE -verify -analyzer-config eagerly-assume=false %s
4 void clang_analyzer_eval(bool);
6 // Do not crash on this templated code which uses a block.
7 typedef void (^my_block
)(void);
8 static void useBlock(my_block block
){}
9 template<class T
> class MyClass
;
10 typedef MyClass
<float> Mf
;
23 template<class T
> const T MyClass
<T
>::one
= static_cast<T
>(1);
24 template<class T
> inline MyClass
<T
>::MyClass(T a
){}
25 template<class T
> void MyClass
<T
>::I() {
26 static MyClass
<T
>* mPtr
= 0;
27 useBlock(^{ mPtr
= new MyClass
<T
> (MyClass
<T
>::one
); });
35 // <rdar://problem/11949235>
36 template<class T
, unsigned N
>
37 inline unsigned array_lengthof(T (&)[N
]) {
41 void testNonTypeTemplateInstantiation() {
42 const char *S
[] = { "a", "b" };
43 clang_analyzer_eval(array_lengthof(S
) == 2);
45 // expected-warning@-2 {{TRUE}}
47 // expected-warning@-4 {{UNKNOWN}}
51 namespace rdar13954714
{
53 bool blockInTemplate() {
59 // force instantiation
60 template bool blockInTemplate
<true>();
63 void blockWithStatic() {
70 // force instantiation
71 template void blockWithStatic
<true>();