- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bug description: the type of an expression consisting of a ternary conditional operator Cond ? E1 : E2, where E1 and E2 have identical rvalue types, should be of the same rvalue type. However, it appears to be an lvalue.
Compiler version: "icpc version 14.0.1 (gcc version 4.7.0 compatibility)"
OS: "Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux"
Sample program:
[cpp]
#include <iostream>
class A {
public:
A() {}
A(const A& other) { std::cout << "copy ctor\\n"; }
A(A&& other) { std::cout << "move ctor\\n"; }
};
int main()
{
A a1;
A a2;
A a3 = true ? std::move(a1) : std::move(a2);
}
[/cpp]
Expected output "move ctor"
Actual output: "copy ctor"
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's only a problem on Linux. It works on Windows.
I'll file a bug to the compiler team for it. Thanks very much for reporting and the test case.
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FYI.
This bug is fixed in 15.0 now. The latest 15.0 is update 2 that just released last week.
Thanks,
Jennifer

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page