public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100982] New: wrong constraint in std::optional::operator=
@ 2021-06-09  3:28 hewillk at gmail dot com
  2021-06-09  6:13 ` [Bug libstdc++/100982] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hewillk at gmail dot com @ 2021-06-09  3:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100982
           Summary: wrong constraint in std::optional::operator=
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

There is a typo in optional#L818:

  template<typename _Up>
    enable_if_t<__and_v<__not_<is_same<_Tp, _Up>>,
                is_constructible<_Tp, const _Up&>,
                is_assignable<_Tp&, _Up>,
                __not_<__converts_from_optional<_Tp, _Up>>,
                __not_<__assigns_from_optional<_Tp, _Up>>>,
                optional&>
    operator=(const optional<_Up>& __u)

It should be is_assignable<_Tp&, const _Up&>.

https://godbolt.org/z/x7Gb9a5v9

#include <optional>

struct U {};

struct T {
  explicit T(const U&);
  T& operator=(const U&);
  T& operator=(U&&) = delete;
};

int main() {
  std::optional<U> opt1;
  std::optional<T> opt2;
  opt2 = opt1;
}

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

* [Bug libstdc++/100982] wrong constraint in std::optional::operator=
  2021-06-09  3:28 [Bug libstdc++/100982] New: wrong constraint in std::optional::operator= hewillk at gmail dot com
@ 2021-06-09  6:13 ` redi at gcc dot gnu.org
  2021-06-09 11:45 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-09  6:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-06-09

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

* [Bug libstdc++/100982] wrong constraint in std::optional::operator=
  2021-06-09  3:28 [Bug libstdc++/100982] New: wrong constraint in std::optional::operator= hewillk at gmail dot com
  2021-06-09  6:13 ` [Bug libstdc++/100982] " redi at gcc dot gnu.org
@ 2021-06-09 11:45 ` cvs-commit at gcc dot gnu.org
  2021-06-09 16:31 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-09 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:b3fce1bd45f72cc9e55fb7431762e92e30fefcf1

commit r12-1327-gb3fce1bd45f72cc9e55fb7431762e92e30fefcf1
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jun 9 11:03:15 2021 +0100

    libstdc++: Fix constraint on std::optional assignment [PR 100982]

    libstdc++-v3/ChangeLog:

            PR libstdc++/100982
            * include/std/optional (optional::operator=(const optional<U>&)):
            Fix value category used in is_assignable check.
            * testsuite/20_util/optional/assignment/100982.cc: New test.

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

* [Bug libstdc++/100982] wrong constraint in std::optional::operator=
  2021-06-09  3:28 [Bug libstdc++/100982] New: wrong constraint in std::optional::operator= hewillk at gmail dot com
  2021-06-09  6:13 ` [Bug libstdc++/100982] " redi at gcc dot gnu.org
  2021-06-09 11:45 ` cvs-commit at gcc dot gnu.org
@ 2021-06-09 16:31 ` redi at gcc dot gnu.org
  2021-06-11 22:26 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-09 16:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
           Keywords|                            |rejects-valid

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

* [Bug libstdc++/100982] wrong constraint in std::optional::operator=
  2021-06-09  3:28 [Bug libstdc++/100982] New: wrong constraint in std::optional::operator= hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2021-06-09 16:31 ` redi at gcc dot gnu.org
@ 2021-06-11 22:26 ` cvs-commit at gcc dot gnu.org
  2021-06-14 18:52 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-11 22:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:e198d93d49f89a3b69f9b4e4c305f9f8b511027a

commit r11-8560-ge198d93d49f89a3b69f9b4e4c305f9f8b511027a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jun 9 11:03:15 2021 +0100

    libstdc++: Fix constraint on std::optional assignment [PR 100982]

    libstdc++-v3/ChangeLog:

            PR libstdc++/100982
            * include/std/optional (optional::operator=(const optional<U>&)):
            Fix value category used in is_assignable check.
            * testsuite/20_util/optional/assignment/100982.cc: New test.

    (cherry picked from commit b3fce1bd45f72cc9e55fb7431762e92e30fefcf1)

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

* [Bug libstdc++/100982] wrong constraint in std::optional::operator=
  2021-06-09  3:28 [Bug libstdc++/100982] New: wrong constraint in std::optional::operator= hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2021-06-11 22:26 ` cvs-commit at gcc dot gnu.org
@ 2021-06-14 18:52 ` cvs-commit at gcc dot gnu.org
  2021-07-22 21:28 ` cvs-commit at gcc dot gnu.org
  2021-07-22 21:30 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-14 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:37864c5e6aa6befc17051f162c02d4f593a57e57

commit r10-9915-g37864c5e6aa6befc17051f162c02d4f593a57e57
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jun 9 11:03:15 2021 +0100

    libstdc++: Fix constraint on std::optional assignment [PR 100982]

    libstdc++-v3/ChangeLog:

            PR libstdc++/100982
            * include/std/optional (optional::operator=(const optional<U>&)):
            Fix value category used in is_assignable check.
            * testsuite/20_util/optional/assignment/100982.cc: New test.

    (cherry picked from commit b3fce1bd45f72cc9e55fb7431762e92e30fefcf1)

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

* [Bug libstdc++/100982] wrong constraint in std::optional::operator=
  2021-06-09  3:28 [Bug libstdc++/100982] New: wrong constraint in std::optional::operator= hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2021-06-14 18:52 ` cvs-commit at gcc dot gnu.org
@ 2021-07-22 21:28 ` cvs-commit at gcc dot gnu.org
  2021-07-22 21:30 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-22 21:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:b06478ca4142ca204133351da45691c787314f64

commit r9-9637-gb06478ca4142ca204133351da45691c787314f64
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jun 9 11:03:15 2021 +0100

    libstdc++: Fix constraint on std::optional assignment [PR 100982]

    libstdc++-v3/ChangeLog:

            PR libstdc++/100982
            * include/std/optional (optional::operator=(const optional<U>&)):
            Fix value category used in is_assignable check.
            * testsuite/20_util/optional/assignment/100982.cc: New test.

    (cherry picked from commit b3fce1bd45f72cc9e55fb7431762e92e30fefcf1)

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

* [Bug libstdc++/100982] wrong constraint in std::optional::operator=
  2021-06-09  3:28 [Bug libstdc++/100982] New: wrong constraint in std::optional::operator= hewillk at gmail dot com
                   ` (5 preceding siblings ...)
  2021-07-22 21:28 ` cvs-commit at gcc dot gnu.org
@ 2021-07-22 21:30 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-22 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 9.5 and 10.4 and 11.2

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

end of thread, other threads:[~2021-07-22 21:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  3:28 [Bug libstdc++/100982] New: wrong constraint in std::optional::operator= hewillk at gmail dot com
2021-06-09  6:13 ` [Bug libstdc++/100982] " redi at gcc dot gnu.org
2021-06-09 11:45 ` cvs-commit at gcc dot gnu.org
2021-06-09 16:31 ` redi at gcc dot gnu.org
2021-06-11 22:26 ` cvs-commit at gcc dot gnu.org
2021-06-14 18:52 ` cvs-commit at gcc dot gnu.org
2021-07-22 21:28 ` cvs-commit at gcc dot gnu.org
2021-07-22 21:30 ` redi 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).