[PATCH] D52248: [SEMA] ignore duplicate declaration specifiers from typeof exprs

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 21 16:52:28 PDT 2018


nickdesaulniers added inline comments.


================
Comment at: lib/Sema/SemaType.cpp:1682
     // or via one or more typedefs."
-    if (!S.getLangOpts().C99 && !S.getLangOpts().CPlusPlus
-        && TypeQuals & Result.getCVRQualifiers()) {
----------------
srhines wrote:
> This is broken for C11 and C17 (even before you touch anything). As we just talked about, let's have a helper function to detect the oldest version (and maybe even that should get promoted as a LANGOPT).
>From the declarations in `include/clang/Frontend/LangStandards.def`, newer versions of C bitwise OR together flags of previous versions. So C99 sets C99 flag, C11 sets C99 and C11 flags, and C17 sets C99, C11, and C17 flags.

So this should be correct (though even to me, this looks wrong on first glance).  Thanks to @george.burgess.iv and you for help in looking into this.


Repository:
  rC Clang

https://reviews.llvm.org/D52248





More information about the cfe-commits mailing list