[LLVMbugs] [Bug 24227] New: Bug when moving from one side of a ternary operator.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 22 23:32:40 PDT 2015


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

            Bug ID: 24227
           Summary: Bug when moving from one side of a ternary operator.
           Product: clang
           Version: 3.6
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: terrelln at umich.edu
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <iostream>
#include <utility>

struct printer {
    printer() { }
    printer(const printer&) { std::cout << "copy" << std::endl; }
    printer(printer&&) { std::cout << "move" << std::endl; }
    printer(const printer&&) { std::cout << "const rvalue ref" << std::endl; }
};

int main() {
    const printer fst;
    printer snd;
    false ? fst : std::move(snd); // Prints: const rvalue ref
}

The ternary operator should move out of snd into a temporary according to the
standard.

See:
http://stackoverflow.com/questions/31577762/moving-out-of-one-side-of-a-ternary-operator
and section 5.16.3 of the standard.

-- 
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/20150723/6eea0d85/attachment.html>


More information about the llvm-bugs mailing list