[llvm-bugs] [Bug 24819] New: -Wmismatched-new-delete confused by reassignment

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 15 01:58:16 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24819

            Bug ID: 24819
           Summary: -Wmismatched-new-delete confused by reassignment
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mariofutire at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 14879
  --> https://llvm.org/bugs/attachment.cgi?id=14879&action=edit
source code to trigger the warning bug

clang reports a mismatched new delete in a legitimate case.

the pointer is first created with new [], then deleted by delete []
and then reallocated with new.

when it is finally deleted with delete I get the warning.

clang does not realise that the live allocation is done with new not new [].

probably even more confusing if the reallocation is conditional.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150915/6feb3dc3/attachment.html>


More information about the llvm-bugs mailing list