[LLVMbugs] [Bug 17893] New: multiple unsequenced modifications and initializer list

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 12 02:18:24 PST 2013


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

            Bug ID: 17893
           Summary: multiple unsequenced modifications and initializer
                    list
           Product: clang
           Version: 3.3
          Hardware: Macintosh
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mail.pourri at laposte.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code:

int count = 23;
int foo[] = { count++, count++, count++ };

Generates a: "warning: multiple unsequenced modifications to 'count'
[-Wunsequenced]"

This is incorrect, as I interpret the C++03 standard, as each initializer
expression in the above is a full-expression (1.9 [intro.execution]/12-13) and
therefore there is a sequence point after each expression (1.9
[intro.execution]/16).
It seems that the standard does not seem to dictate the order in which the
expressions are evaluated, which, as far as I know seems to be left to right in
all compilers I've tested.

BTW, in C++11, this is an allowed statement, and Clang actually silent the
warning by itself.

-- 
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/20131112/4d95a3bb/attachment.html>


More information about the llvm-bugs mailing list