public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110441] New: c++17 deferred materialization of temporaries fails when calling class static with member syntax
@ 2023-06-27 18:48 eric.niebler at gmail dot com
  2023-06-28 12:47 ` [Bug c++/110441] c++17: temporary causes static member function call to confuse required copy elision gasper.azman at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: eric.niebler at gmail dot com @ 2023-06-27 18:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110441

            Bug ID: 110441
           Summary: c++17 deferred materialization of temporaries fails
                    when calling class static with member syntax
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric.niebler at gmail dot com
  Target Milestone: ---

struct immovable {
  immovable() = default;
  immovable(immovable &&) = delete;
};

struct S {
  static immovable f() {
    return {};
  }
};

immovable g() { 
  return S().f();
}

compile with -std=c++17. Result:

<source>: In function 'immovable g()':
<source>:14:15: error: use of deleted function
'immovable::immovable(immovable&&)'
   14 |   return S().f();
      |          ~~~~~^~
<source>:4:3: note: declared here
    4 |   immovable(immovable &&) = delete;
      |   ^~~~~~~~~


https://godbolt.org/z/Y1h9bPrf3

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

end of thread, other threads:[~2023-07-15 14:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 18:48 [Bug c++/110441] New: c++17 deferred materialization of temporaries fails when calling class static with member syntax eric.niebler at gmail dot com
2023-06-28 12:47 ` [Bug c++/110441] c++17: temporary causes static member function call to confuse required copy elision gasper.azman at gmail dot com
2023-06-28 12:48 ` gasper.azman at gmail dot com
2023-06-28 14:27 ` ppalka at gcc dot gnu.org
2023-06-28 14:30 ` ppalka at gcc dot gnu.org
2023-06-28 15:23 ` matt.cross+gcc-bugzilla at gmail dot com
2023-07-15 13:53 ` cvs-commit at gcc dot gnu.org
2023-07-15 14:00 ` ppalka 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).