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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to