[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 18 12:42:56 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/test/AST/Interp/builtin-functions.cpp:44
+
+ constexpr float Nan2 = __builtin_nans([](){return "0xAE98";}()); // ref-error {{must be initialized by a constant expression}}
+}
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > Probably worth a comment here mentioning that the ref-error is a rejects-valid issue that the experimental compiler accepts correctly.
> I thought you said on Discord that the current interpreter is correct? I made the new one reject anything but string literals in https://reviews.llvm.org/D155545.
Oops, crossing streams as I just mentioned this in another review of yours in the same area.
I think I misunderstood the question on Discord when we were chatting. I was thinking the situation was more that Sema was allowing through something like `__builtin_nan(12);` and diagnosing it later during CodeGen. I think constexpr builtins should generally behave the same as regular constexpr functions the user could write.
I'm really sorry if I made extra work for you with this confusion!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155356/new/
https://reviews.llvm.org/D155356
More information about the cfe-commits
mailing list