<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:dblaikie@gmail.com" title="David Blaikie <dblaikie@gmail.com>"> <span class="fn">David Blaikie</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Constexpr new: uncatched UB in constant context"
   href="https://bugs.llvm.org/show_bug.cgi?id=43685">bug 43685</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Constexpr new: uncatched UB in constant context"
   href="https://bugs.llvm.org/show_bug.cgi?id=43685#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Constexpr new: uncatched UB in constant context"
   href="https://bugs.llvm.org/show_bug.cgi?id=43685">bug 43685</a>
              from <span class="vcard"><a class="email" href="mailto:dblaikie@gmail.com" title="David Blaikie <dblaikie@gmail.com>"> <span class="fn">David Blaikie</span></a>
</span></b>
        <pre>(In reply to Alexander Zaitsev from <a href="show_bug.cgi?id=43685#c3">comment #3</a>)
<span class="quote">> I don't know a lot about internals and how it can be detected (I trust you
> that checking something like that is undetectable). But if it's undefined
> behavior in C++ standard it shall lead to compile error in constexpr (AFAIK
> constexpr context cannot have UB inside and all code with UB shall lead to
> compile error).</span >

So the wording in C++17 is as follows:

8.20 [expr.const] p2

"An expression e is a core constant expression unless the evaluation of e,
following the rules of the abstract machine (4.6), would evaluate one of the
following expressions:"
...
"an operation that would have undefined behavior as specified in Clauses 4
through 19 of this document"

That specifically does not include Clause 20, which is where the standard
library is defined.

So I believe the compiler behavior you're observing is conforming, though the
code is non-portable (as it's /possible/ that some other implementation might
have UB (as specified in Clauses 4 through 19) on these codepaths - but it's
not required that they do).</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>