[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 26 10:38:48 PDT 2023
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LG!
================
Comment at: clang/test/AST/Interp/builtin-functions.cpp:53
+ constexpr char f[] = {'0', 'x', 'A', 'E', '\0'};
+ constexpr double NaN6 = __builtin_nan(f); // ref-error {{must be initialized by a constant expression}}
+
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > This should be accepted, shouldn't it? The payload is a valid integer constant (as a string).
> So answer both your questions: Yes, but the current interpreter has a `isa<StringLiteral>()` check and rejects everything that isn't a string literal.
Ah! Slap some FIXME comments around the two cases to explain what's going on and that can be solved separately. Seem reasonable?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155356/new/
https://reviews.llvm.org/D155356
More information about the cfe-commits
mailing list