[cfe-dev] Missing lvalue to rvalue in delete argument
Abramo Bagnara
abramo.bagnara at gmail.com
Wed Nov 16 01:54:47 PST 2011
The following typescript shows that:
1) we have a wrong cast NoOp kind in void * cast of delete argument
2) we miss the lvalue to rvalue cast for delete argument
I you confirm that this is not intended I'll proceed to fix that.
$ cat w.cc
void f(void *) {
int *a = new int;
f(a);
delete a;
}
abramo at igor:~$ _clang++ -cc1 -ast-dump w.cc
typedef char *__builtin_va_list;
void f(void *) (CompoundStmt 0xc4b0658 <w.cc:1:16, line:5:1>
(DeclStmt 0xc4b0530 <line:2:3, col:19>
0xc4b00c0 "int *a =
(CXXNewExpr 0xc4b04f8 <col:12, col:16> 'int *')")
(CallExpr 0xc4b05d8 <line:3:3, col:6> 'void'
(ImplicitCastExpr 0xc4b05c8 <col:3> 'void (*)(void *)'
<FunctionToPointerDecay>
(DeclRefExpr 0xc4b058c <col:3> 'void (void *)' lvalue Function
0xc4b0030 'f' 'void (void *)'))
(ImplicitCastExpr 0xc4b0608 <col:5> 'void *' <BitCast>
(ImplicitCastExpr 0xc4b05f8 <col:5> 'int *' <LValueToRValue>
(DeclRefExpr 0xc4b0574 <col:5> 'int *' lvalue Var 0xc4b00c0 'a'
'int *'))))
(CXXDeleteExpr 0xc4b0640 <line:4:3, col:10> 'void'
(ImplicitCastExpr 0xc4b0630 <col:10> 'void *' <NoOp>
(DeclRefExpr 0xc4b0614 <col:10> 'int *' lvalue Var 0xc4b00c0 'a'
'int *'))))
void *operator new(unsigned int) throw(std::bad_alloc);
void *operator new[](unsigned int) throw(std::bad_alloc);
void operator delete(void *) throw();
void operator delete[](void *) throw();
More information about the cfe-dev
mailing list