public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/86303] Constructor is not used for type conversion
       [not found] <bug-86303-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-06  9:27 ` pinskia at gcc dot gnu.org
  2024-04-03 20:25 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-06  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 7+ accepts it for C++17 and C++20 but rejects it for C++11 and C++14. 
Maybe there was a rule change.

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

* [Bug c++/86303] Constructor is not used for type conversion
       [not found] <bug-86303-4@http.gcc.gnu.org/bugzilla/>
  2021-09-06  9:27 ` [Bug c++/86303] Constructor is not used for type conversion pinskia at gcc dot gnu.org
@ 2024-04-03 20:25 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-03 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the rule change for C++17+ is the "Prvalue semantics" (which is described
here https://en.cppreference.com/w/cpp/language/copy_elision ). In C++11 and
C++14, copy elision is not required to be done and you need to do a copy so the
code is invalid since there is a copy that needed to done but there is no way
to do a copy in this case since the "copy constructor" cannot bind a temporary.

Anyways clang accepts it for C++11 and C++14 modes is a bug there and should be
reported back to them.

Note clang/msvc does not even use:
 auto_ptr(auto_ptr_ref);
for C++11 as if I mark it as delete(d), clang accepts it still.

Which makes me suspecision of them doing the copy elision but then not also
checking if the copy would be valid. In the case of GCC there was a bug
previously where the check was not done and it was fixed and there was many
complaints in then but that was over 10 years ago.

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

end of thread, other threads:[~2024-04-03 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-86303-4@http.gcc.gnu.org/bugzilla/>
2021-09-06  9:27 ` [Bug c++/86303] Constructor is not used for type conversion pinskia at gcc dot gnu.org
2024-04-03 20:25 ` 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).