[PATCH] D129881: [C] Strengthen -Wint-conversion to default to an error

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 15 10:54:54 PDT 2022


efriedma added a comment.

Given this is an on-by-default warning already, I don't expect changing it to an error by default to have much impact in practice.  Changing it fine.



================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:8483
+    if ((SemaRef.getLangOpts().CPlusPlus && Trap.hasErrorOccurred()) ||
+        Res.isInvalid())
       return ExprError();
----------------
I'd prefer not to introduce unnecessary differences in C vs. C++ handling like this...

This seems weird for two reasons:

- We don't use ext_typecheck_convert_pointer_int in C++, so there's not really any reason to mark it SFINAEFailure
- Whatever code is calling this probably doesn't want an SFINAE context.  Is this coming from TransformToPotentiallyEvaluated?  We don't want SFINAE traps from there, in C or C++.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129881



More information about the cfe-commits mailing list