This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/62227] New: Templated move not elided
- From: "roman.perepelitsa at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 22 Aug 2014 11:36:53 +0000
- Subject: [Bug c++/62227] New: Templated move not elided
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62227
Bug ID: 62227
Summary: Templated move not elided
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: roman.perepelitsa at gmail dot com
#include <stdio.h>
struct S {
S(int) {}
S(const S&) = default; // (1)
template <class = void> // (2)
S(S&& other) {
puts("move");
}
};
int main() {
S s = 42;
(void)s;
}
This program unexpectedly prints "move". The expected output is empty (move is
elided).
The program prints nothing (as expected) if any of the following is done:
- Line (1) is removed.
- Line (2) is removed.
- The program is compiled with clang.