Please open a bug report instead.
Best Jonas
Am 19.10.2018 um 00:39 schrieb Mat Sutcliffe via cfe-users:
> Hello list,
>
> The following code generates one false positive of the -Wcomma
> warning: (tested with clang trunk via Matt Godbolt's Compiler
> Explorer)
>
> template <typename T>
> void foo()
> {
> (void)42, 0; // ok
> static_cast<void>(42), 0; // ok
>
> (void)T{}, 0; // ok
> static_cast<void>(T{}), 0; // false positive
> }
>
> The warning ignores comma expressions where the LHS is a CastExpr with
> a CastKind of CK_ToVoid, but the expression static_cast<void>(T{}) has
> a CastKind of CK_Dependent (confirmed with Compiler Explorer's AST
> view).
>
> I came across this when trying to do the "expander trick" without a
> fold expression or C-style cast, as in
> https://stackoverflow.com/a/30563282/1639256
>
> Thanks
> Mat
> _______________________________________________
> cfe-users mailing list
> [email protected]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
_______________________________________________
cfe-users mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users