[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:21:01 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/test/AST/Interp/builtin-functions.cpp:45
+ /// The current interpreter does not accept this, but it should.
+ constexpr float NaN2 = __builtin_nans([](){return "0xAE98";}()); // ref-error {{must be initialized by a constant expression}}
+
----------------
This should be accepted by both the current and the new interpreter, right?
================
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}}
+
----------------
This should be accepted, shouldn't it? The payload is a valid integer constant (as a string).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155356/new/
https://reviews.llvm.org/D155356
More information about the cfe-commits
mailing list