You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rfcs/0000-const-ub.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ While compiling untrusted code should only be done with care (including addition
67
67
[prior-art]: #prior-art
68
68
69
69
C++ requires compilers to detect UB in `constexpr`.
70
-
However, the fragment of C++ that is available to `constexpr` excludes pointer casts (TODO: and pointer arithmetic and unions?), which makes such checks not very complicated and avoids all the poorly specified parts of UB.
70
+
However, the fragment of C++ that is available to `constexpr` excludes pointer casts, pointer arithmetic (beyond array bounds), and union-based type punning, which makes such checks not very complicated and avoids most of the poorly specified parts of UB.
71
71
72
72
If we found a way to run CTFE on unoptimized MIR, then detecting UB for programs that do not use unions, `transmute`, or raw pointers is not very hard.
73
73
CTFE already has almost all the checks required for this, except for alignment checks which are disabled during CTFE.
0 commit comments