<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - False positive on calling new(std::size_t, std::align_val_t)"
   href="https://bugs.llvm.org/show_bug.cgi?id=44693">44693</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False positive on calling new(std::size_t, std::align_val_t)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>cassio.neri@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider:

    struct X {
        alignas(32) char c;
    };

    int main() {
        X* p = new X; // #1
        delete p;
    }

compiled with

    scan-build clang++ -g -std=c++17 main.cpp

yields warning: Function taking 2 arguments is called with fewer (1)
    X* p = new X;"
           ^~~~~

Since X is an over-aligned type, in C++17 the new expression in #1 makes the
compiler to call operator new(std::size_t, std::align_val_t). It seems the
static analyzer believes the compiler behaves as per C++14 and makes a call to
new(std::size_t).

At least the warning could output a more informative message mentioning
over-alignment.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>