https://bugs.llvm.org/show_bug.cgi?id=43685

David Blaikie <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #4 from David Blaikie <[email protected]> ---
(In reply to Alexander Zaitsev from comment #3)
> 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).

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).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to