Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-30798

Placement new an object show warnings by built-in parser

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • Qt Creator 14.0.2
    • Qt Creator 11.0.2, Qt Creator 13.0.2
    • C/C++/Obj-C++ Support
    • None
    • macOS
    • 9a8cba372 (14.0)

    Description

      when I type codes as following:

      #include <stdlib.h>
      
      class A
      {
      public:
        A()
        {
          printf("A()\n");
        }
      };
      
      int main(int argc, char* argv[])
      {
        A* a = malloc(sizeof(A));
        a = new(a) A();
        return 0;
      }

      there is an syntax warning shows:

      after I delete the `()` after A in line 17, the warning disappears.

      the reason looks like builtin-parser cannot analysis the empty param list of constructor function in placement new operator.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTCREATORBUG-30798
          # Subject Branch Project Status CR V

          Activity

            People

              kandeler Christian Kandeler
              zhangcd cd z
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes