[PATCH] D22334: Fix for Bug 28172 : clang crashes on invalid code (with too few arguments to __builtin_signbit) without any proper diagnostics.

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 26 09:19:37 PDT 2016


majnemer added a comment.

This looks much better. Please add a test that uses a template:

  template <typename T>
  int f(T t) { return __builtin_signbit(t); }


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7401-7403
@@ -7400,2 +7400,5 @@
 
+def err_builtin_signbit_wrong_argument : Error<
+  "Argument type mismatch, must be float, double or long double">;
+
 // CFString checking
----------------
Hmm, I think it would be better if you added this near `err_typecheck_cond_expect_int_float`, named it `err_typecheck_cond_expect_float`, and gave it a similar error message.


https://reviews.llvm.org/D22334





More information about the cfe-commits mailing list