public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62227] New: Templated move not elided
@ 2014-08-22 11:37 roman.perepelitsa at gmail dot com
  2014-08-23 23:12 ` [Bug c++/62227] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: roman.perepelitsa at gmail dot com @ 2014-08-22 11:37 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-23  0:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-22 11:37 [Bug c++/62227] New: Templated move not elided roman.perepelitsa at gmail dot com
2014-08-23 23:12 ` [Bug c++/62227] " redi at gcc dot gnu.org
2014-08-24 23:20 ` redi at gcc dot gnu.org
2014-08-24 23:24 ` redi at gcc dot gnu.org
2021-08-23  0:28 ` [Bug c++/62227] [DR535] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).