[cfe-commits] [PATCH] Check access and ambiguity of delete operator
Alex Miller
millerdevel at gmail.com
Fri Jan 21 16:39:49 PST 2011
The attached patch should fix the TODO at lib/Sema/SemaExprCXX.cpp:1610
When compiling the following code
class Foo {
private:
~Foo();
};
void do_foo() {
Foo *f = new Foo;
delete f;
}
clang now emits the error
testcase.cpp:8:10: error: calling a private destructor of class 'Foo *'
delete f;
^
testcase.cpp:3:5: note: declared private here
~Foo();
^
1 error generated.
instead of compiling the code successfully.
If someone could point out how to turn the QualType instance representing
'Foo *' into just 'Foo', I'd appreciate it.
Thanks,
Alex Miller
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110121/a644f88d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: delete_access_check.patch
Type: text/x-patch
Size: 1456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110121/a644f88d/attachment.bin>
More information about the cfe-commits
mailing list