Duplicated warning message in -Wcomma (original) (raw)

Bugzilla Link 46438
Version trunk
OS Linux
CC @zygoloid

Extended Description

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( )
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( )
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( )
1 warning generated.