This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/56289] New: Bad unused value warning with comma operator


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289

             Bug #: 56289
           Summary: Bad unused value warning with comma operator
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thomaseding@gmail.com


Compile the following with -Wunused-value:

int main () {
    int x = 0;
    int y = 0;
    (void) x, y; /* warning: right operand of comma operator has no effect
[-Wunused-value] */
    return 0;
}


This is a bad warning, as casting to void should eliminate the warning for both
x and y.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]