[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 10:37:12 PDT 2023


tbaeder added inline comments.


================
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}}
+
----------------
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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155356/new/

https://reviews.llvm.org/D155356



More information about the cfe-commits mailing list