[PATCH] D146436: [clang][Interp][NFC] Add tests for __fp16

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 12:31:01 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/test/AST/Interp/floats.cpp:110-111
+
+  static_assert(~2.0f == 3, ""); // ref-error {{invalid argument type 'float' to unary expression}} \
+                                 // expected-error {{invalid argument type 'float' to unary expression}}
+
----------------
This gets rejected before we even get to the constant expression interpreter, right?


================
Comment at: clang/test/AST/Interp/floats.cpp:120-121
+
+  const int k = 3 * (1.0f16 / 3.0f16);
+  static_assert(k == 1, "");
+
----------------
I'm curious to see what the bot farm thinks of tests like this -- they're constant expression tests, but constant expressions are supposed to follow the target floating-point model where this might be inexact.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146436



More information about the cfe-commits mailing list