http://llvm.org/bugs/show_bug.cgi?id=22197

            Bug ID: 22197
           Summary: False warning: unsequenced modification and access to
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Created attachment 13667
  --> http://llvm.org/bugs/attachment.cgi?id=13667&action=edit
Source code showing the false warning

When compiling the attached code with -Wunsequenced, clang issues a warning
that I believe is incorrect:

---
$ c++ -Wunsequenced -c test.cpp           
test.cpp:5:12: warning: unsequenced modification and access to 'i'
[-Wunsequenced]
    if ((i = f1(), true) && (j = f2(i))) {
           ^                        ~
1 warning generated.
---

There should be sequence points between the operands of the comma-operator and
those of &&.

If you wonder about "true", the code is generated and the condition will not
always be constant true.

Interestingly, the same code does not issue a warning when compiled as C code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to