[PATCH] D130894: [clang] Print more information about failed static assertions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 04:59:49 PDT 2022


aaron.ballman added a comment.

In D130894#3715725 <https://reviews.llvm.org/D130894#3715725>, @mstorsjo wrote:

> In D130894#3715709 <https://reviews.llvm.org/D130894#3715709>, @aaron.ballman wrote:
>
>> In D130894#3715143 <https://reviews.llvm.org/D130894#3715143>, @xbolva00 wrote:
>>
>>> In D130894#3715124 <https://reviews.llvm.org/D130894#3715124>, @mstorsjo wrote:
>>>
>>>> This broke building with GCC (also noted by buildbot mails):
>>>>
>>>>   ../tools/clang/lib/Sema/SemaDeclCXX.cpp: In member function ‘void clang::Sema::DiagnoseStaticAssertDetails(const clang::Expr*)’:
>>>>   ../tools/clang/lib/Sema/SemaDeclCXX.cpp:16666:19: error: declaration of ‘const clang::Expr* clang::Sema::DiagnoseStaticAssertDetails(const clang::Expr*)::<unnamed struct>::Expr’ changes meaning of ‘Expr’ [-fpermissive]
>>>>   16666 |       const Expr *Expr;
>>>>         |                   ^~~~
>>>>   In file included from ../tools/clang/include/clang/AST/DeclCXX.h:22,
>>>>                    from ../tools/clang/include/clang/AST/ASTLambda.h:18,
>>>>                    from ../tools/clang/lib/Sema/SemaDeclCXX.cpp:15:
>>>>   ../tools/clang/include/clang/AST/Expr.h:109:7: note: ‘Expr’ declared here as ‘class clang::Expr’
>>>>     109 | class Expr : public ValueStmt {
>>>>         |       ^~~~
>>>
>>> It is kinda bad that GCC throws an error and Clang does not even print a warning.
>>>
>>> How is it even possible? Clang does not implement strict(er) rules ? @aaron.ballman
>>
>> I pushed up a change to "fix" this
>
> FWIW, the same issue actually already was fixed by ebe0674acb8bb3404d0e2a6b689d5e3cd02bb0b6 <https://reviews.llvm.org/rGebe0674acb8bb3404d0e2a6b689d5e3cd02bb0b6> - although your commit made it even clearer.

Oh neat, thanks for pointing that out! I reflexively rename declarations when they share the name of a type because I have run into similar issues to this before, but it's usually things like IDE "go to definition" behavior that winds up breaking, not the build. (I run into this all the time with people doing `const Attr *Attr`)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130894



More information about the cfe-commits mailing list