[PATCH] D79945: [Sema] Comparison of pointers to complete and incomplete types

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 10:25:38 PDT 2020


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:11571
+          Diag(Loc,
+               getLangOpts().C11
+                   ? diag::ext_typecheck_compare_complete_incomplete_pointers
----------------
pestctrl wrote:
> efriedma wrote:
> > I think this condition is backwards?  Should be `!getLangOpts().C11`.  You want the warning with `-std=c99 -pedantic`, you don't want the warning with `std=c11 -pedantic`.
> I don't think it's backwards. If getLangOpts().C11, then it is an extension. Otherwise, it is the warning. I can switch the conditions if it is confusing though.
"Extension" means "this is invalid code that we're accepting anyway" -- that's what this is in C99. In C11, I think we shouldn't be diagnosing at all.

Has anyone checked whether WG14 removed this restriction in C11 as a DR resolution? If so, we shouldn't be diagnosing it at all, in any language mode.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79945





More information about the cfe-commits mailing list