[llvm-bugs] [Bug 46438] New: Duplicated warning message in -Wcomma

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 24 07:23:59 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46438

            Bug ID: 46438
           Summary: Duplicated warning message in -Wcomma
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haoxintu at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

This code, bug.cc, clang-9 to clang-trunk emit two duplicated warning message
"warning: possible misuse of comma operator here [-Wcomma]", while clang-6 to
clang-8 just give one warning message about this.

$cat bug.cc
const long var = 10;
static_assert (1 ? ( 0 , var ) : 0 , "" );

$clang++-trunk -Wcomma -c bug.cc 
bug.cc:2:24: warning: possible misuse of comma operator here [-Wcomma]
static_assert (1 ? ( 0 , var ) : 0 , "" );
                       ^
bug.cc:2:22: note: cast expression to void to silence warning
static_assert (1 ? ( 0 , var ) : 0 , "" );
                     ^
                     static_cast<void>( )
bug.cc:2:24: warning: possible misuse of comma operator here [-Wcomma]
static_assert (1 ? ( 0 , var ) : 0 , "" );
                       ^
bug.cc:2:22: note: cast expression to void to silence warning
static_assert (1 ? ( 0 , var ) : 0 , "" );
                     ^
                     static_cast<void>( )
2 warnings generated.


$clang++-8 -Wcomma -c bug.cc 
bug.cc:2:24: warning: possible misuse of comma operator here [-Wcomma]
static_assert (1 ? ( 0 , var ) : 0 , "" );
                       ^
bug.cc:2:22: note: cast expression to void to silence warning
static_assert (1 ? ( 0 , var ) : 0 , "" );
                     ^
                     static_cast<void>( )
1 warning generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200624/ca6c0d9a/attachment.html>


More information about the llvm-bugs mailing list