1 // RUN: %clang_analyze_cc1 -std=c++14 -analyzer-checker=core,cplusplus.NewDelete -verify %s
3 // expected-no-diagnostics:
4 // From now the profile of the 'StackFrameContext' also contains the
5 // 'NodeBuilderContext::blockCount()'. With this addition we can distinguish
6 // between the 'StackArgumentsSpaceRegion' of the 'P' arguments being different
9 typedef __INTPTR_TYPE__
intptr_t;
11 template <typename PointerTy
>
12 struct SmarterPointer
{
13 PointerTy
getFromVoidPointer(void *P
) const {
14 return static_cast<PointerTy
>(P
);
17 PointerTy
getPointer() const {
18 return getFromVoidPointer(reinterpret_cast<void *>(Value
));
25 SmarterPointer
<Node
*> Pred
;
30 SmarterPointer
<Node
*> Next
= N
->Pred
;
33 N
= Next
.getPointer();
34 // no-warning: 'Use of memory after it is freed' was here as the same
35 // 'StackArgumentsSpaceRegion' purged out twice as 'P'.