[PATCH] D35817: Ban implicit _Complex to scalar conversions in C++

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 16:31:16 PDT 2017


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:9372
     if (!isa<ComplexType>(Target)) {
-      if (S.SourceMgr.isInSystemMacro(CC))
+      if (S.SourceMgr.isInSystemMacro(CC) || Target->isBooleanType())
         return;
----------------
Do we really want to have different semantic rules for code from system macros?

If so, the way we usually do this is with a `DefaultError` `ExtWarn` (an off-by-default extension).


================
Comment at: clang/test/SemaCXX/warn-absolute-value.cpp:452
-  (void)abs(x);
-  // expected-warning at -1 {{using integer absolute value function 'abs' when argument is of complex type}}
-  // expected-note at -2 {{use function 'cabsf' instead}}
----------------
Do we have test coverage for this diagnostic in C still? (It seems to be unreachable in C++ now.)


https://reviews.llvm.org/D35817





More information about the cfe-commits mailing list