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.