<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 - std::numeric_limits doesn't fail when used with non-arithmetic data types"
   href="https://bugs.llvm.org/show_bug.cgi?id=47734">47734</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>std::numeric_limits doesn't fail when used with non-arithmetic data types
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>yuri@tsoft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24022" name="attach_24022" title="testcase-numeric_limits-doesnt-fail-on-non-arithmetic-types.cpp">attachment 24022</a> <a href="attachment.cgi?id=24022&action=edit" title="testcase-numeric_limits-doesnt-fail-on-non-arithmetic-types.cpp">[details]</a></span>
testcase-numeric_limits-doesnt-fail-on-non-arithmetic-types.cpp

The attached testcase uses std::numeric_limits on a regular class (a
non-arithmetic type) and compilation doesn't fail.

<a href="https://en.cppreference.com/w/cpp/types/numeric_limits">https://en.cppreference.com/w/cpp/types/numeric_limits</a> says that
<span class="quote">> numeric_limits class template provides a standardized way to query various properties of arithmetic types"</span >

This implies that it isn't applicable to non-arithmetic types. Therefore,
std::numeric_limits should be left undefined for all non-arithmetic types so
that the errors with its use can be caught by the compiler.

Specifically, I got std::numeric_limits<Z>::min_exponent10 evaluated to zero
for a regular class type, which caused a division by zero error that had to be
caught by the compiler.</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>