<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 - /permissive- and Implicit conversion of integral constant expressions to null pointer."
   href="https://bugs.llvm.org/show_bug.cgi?id=51582">51582</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>/permissive- and Implicit conversion of integral constant expressions to null pointer.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>C++17
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tormardi@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25182" name="attach_25182" title="Bad overload chosen, -Wnon-literal-null-conversion">attachment 25182</a> <a href="attachment.cgi?id=25182&action=edit" title="Bad overload chosen, -Wnon-literal-null-conversion">[details]</a></span>
Bad overload chosen, -Wnon-literal-null-conversion

From

<a href="https://docs.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=msvc-160&viewFallbackFrom=vs-2019#implicit">https://docs.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=msvc-160&viewFallbackFrom=vs-2019#implicit</a>\
\-conversion-of-integral-constant-expressions-to-null-pointer

"The MSVC compiler now implements CWG Issue 903 in conformance mode
 (/permissive-). This rule disallows implicit conversion of integral
 constant expressions (except for the integer literal '0') to null
 pointer constants."

The attached snippet, built with clang 12.0.1 for windows outputs
  CTOR two
  CTOR three

And so does Visual Studio with "/permissive"
With "/permissive-" Visual Studio gets it right.

clang says:
warning: expression which evaluates to zero treated as a null pointer
constant of type 'int *const'
[-Wnon-literal-null-conversion]

If I remove 'constexpr' the warning goes away, and we get correct behaviour.</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>