public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references
@ 2023-02-27 16:14 christian.mazakas at gmail dot com
  2023-02-27 16:15 ` [Bug libstdc++/108952] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: christian.mazakas at gmail dot com @ 2023-02-27 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108952
           Summary: Regression in uses_allocator_construction_args for
                    pair of rvalue references
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christian.mazakas at gmail dot com
  Target Milestone: ---

Consider the following example as demonstrated on Compiler Explorer:
https://godbolt.org/z/jhxxK9hT3

The C++20 version of uses_allocator_construction_args seems to inappropriately
forward the pair's data members and when they happen to be rvalue references,
they decay to an lvalue reference which breaks constructibility tests.

This same code will pass for previous standards versions.

I'm not sure about the range of compilers affected by this but it seems to
follow wherever C++20 support is enabled.

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

* [Bug libstdc++/108952] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
@ 2023-02-27 16:15 ` pinskia at gcc dot gnu.org
  2023-02-27 17:03 ` redi at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-27 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 54546
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54546&action=edit
testcase

Please next time also attach or put inline the testcase

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

* [Bug libstdc++/108952] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
  2023-02-27 16:15 ` [Bug libstdc++/108952] " pinskia at gcc dot gnu.org
@ 2023-02-27 17:03 ` redi at gcc dot gnu.org
  2023-02-27 17:18 ` rs2740 at gmail dot com
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-27 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-27

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The problem is that std::move(pr).first always yields an lvalue, even if the
type of pr is pair<T&&, U&&>.

I tried to simplify uses_allocator_construction_args to avoid indirection,
which I think is the source of this issue.

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

* [Bug libstdc++/108952] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
  2023-02-27 16:15 ` [Bug libstdc++/108952] " pinskia at gcc dot gnu.org
  2023-02-27 17:03 ` redi at gcc dot gnu.org
@ 2023-02-27 17:18 ` rs2740 at gmail dot com
  2023-02-27 17:33 ` pdimov at gmail dot com
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rs2740 at gmail dot com @ 2023-02-27 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

TC <rs2740 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rs2740 at gmail dot com

--- Comment #3 from TC <rs2740 at gmail dot com> ---
https://cplusplus.github.io/LWG/issue3527

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

* [Bug libstdc++/108952] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (2 preceding siblings ...)
  2023-02-27 17:18 ` rs2740 at gmail dot com
@ 2023-02-27 17:33 ` pdimov at gmail dot com
  2023-02-27 17:34 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pdimov at gmail dot com @ 2023-02-27 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Dimov <pdimov at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pdimov at gmail dot com

--- Comment #4 from Peter Dimov <pdimov at gmail dot com> ---
An easy fix is to use `std::get<0>` instead of `.first`.

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

* [Bug libstdc++/108952] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (3 preceding siblings ...)
  2023-02-27 17:33 ` pdimov at gmail dot com
@ 2023-02-27 17:34 ` redi at gcc dot gnu.org
  2023-02-27 21:27 ` [Bug libstdc++/108952] [10/11/12/13 Regression] " redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-27 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Peter Dimov from comment #4)
> An easy fix is to use `std::get<0>` instead of `.first`.

Yeah I tried that, but I think there's an additional change needed (or I messed
something up).

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

* [Bug libstdc++/108952] [10/11/12/13 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (4 preceding siblings ...)
  2023-02-27 17:34 ` redi at gcc dot gnu.org
@ 2023-02-27 21:27 ` redi at gcc dot gnu.org
  2023-02-28  9:50 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-27 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Regression in               |[10/11/12/13 Regression]
                   |uses_allocator_construction |Regression in
                   |_args for pair of rvalue    |uses_allocator_construction
                   |references                  |_args for pair of rvalue
                   |                            |references
           Keywords|                            |rejects-valid
      Known to fail|                            |10.1.0, 11.1.0, 12.1.0,
                   |                            |13.0, 9.2.0
      Known to work|                            |8.5.0, 9.1.0

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Aha, I broke std::get(pair<T1, T2>&&) for C++20 mode.

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

* [Bug libstdc++/108952] [10/11/12/13 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (5 preceding siblings ...)
  2023-02-27 21:27 ` [Bug libstdc++/108952] [10/11/12/13 Regression] " redi at gcc dot gnu.org
@ 2023-02-28  9:50 ` cvs-commit at gcc dot gnu.org
  2023-02-28  9:53 ` [Bug libstdc++/108952] [10/11/12 " redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-28  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:8e342c04550466ab088c33746091ce7f3498ee44

commit r13-6373-g8e342c04550466ab088c33746091ce7f3498ee44
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Feb 27 22:34:57 2023 +0000

    libstdc++: Fix uses_allocator_construction_args for pair<T&&, U&&>
[PR108952]

    This implements LWG 3527 which fixes the handling of pair<T&&, U&&> in
    std::uses_allocator_construction_args.

    libstdc++-v3/ChangeLog:

            PR libstdc++/108952
            * include/bits/uses_allocator_args.h
            (uses_allocator_construction_args): Implement LWG 3527.
            * testsuite/20_util/pair/astuple/get-2.cc: New test.
            * testsuite/20_util/scoped_allocator/108952.cc: New test.
            * testsuite/20_util/uses_allocator/lwg3527.cc: New test.

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

* [Bug libstdc++/108952] [10/11/12 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (6 preceding siblings ...)
  2023-02-28  9:50 ` cvs-commit at gcc dot gnu.org
@ 2023-02-28  9:53 ` redi at gcc dot gnu.org
  2023-02-28 10:40 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-28  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11/12/13 Regression]    |[10/11/12 Regression]
                   |Regression in               |Regression in
                   |uses_allocator_construction |uses_allocator_construction
                   |_args for pair of rvalue    |_args for pair of rvalue
                   |references                  |references

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug libstdc++/108952] [10/11/12 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (7 preceding siblings ...)
  2023-02-28  9:53 ` [Bug libstdc++/108952] [10/11/12 " redi at gcc dot gnu.org
@ 2023-02-28 10:40 ` rguenth at gcc dot gnu.org
  2023-04-27 14:44 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-28 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.5
           Priority|P3                          |P2

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

* [Bug libstdc++/108952] [10/11/12 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (8 preceding siblings ...)
  2023-02-28 10:40 ` rguenth at gcc dot gnu.org
@ 2023-04-27 14:44 ` cvs-commit at gcc dot gnu.org
  2023-04-27 14:52 ` [Bug libstdc++/108952] [10/11 " redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:858ff5c919fc1af31e399a7aea118c87f855972a

commit r12-9487-g858ff5c919fc1af31e399a7aea118c87f855972a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Feb 27 22:34:57 2023 +0000

    libstdc++: Fix uses_allocator_construction_args for pair<T&&, U&&>
[PR108952]

    This implements LWG 3527 which fixes the handling of pair<T&&, U&&> in
    std::uses_allocator_construction_args.

    libstdc++-v3/ChangeLog:

            PR libstdc++/108952
            * include/bits/uses_allocator_args.h
            (uses_allocator_construction_args): Implement LWG 3527.
            * testsuite/20_util/pair/astuple/get-2.cc: New test.
            * testsuite/20_util/scoped_allocator/108952.cc: New test.
            * testsuite/20_util/uses_allocator/lwg3527.cc: New test.

    (cherry picked from commit 8e342c04550466ab088c33746091ce7f3498ee44)

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

* [Bug libstdc++/108952] [10/11 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (9 preceding siblings ...)
  2023-04-27 14:44 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27 14:52 ` redi at gcc dot gnu.org
  2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-27 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11/12 Regression]       |[10/11 Regression]
                   |Regression in               |Regression in
                   |uses_allocator_construction |uses_allocator_construction
                   |_args for pair of rvalue    |_args for pair of rvalue
                   |references                  |references

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 12.3 too.

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

* [Bug libstdc++/108952] [10/11 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (10 preceding siblings ...)
  2023-04-27 14:52 ` [Bug libstdc++/108952] [10/11 " redi at gcc dot gnu.org
@ 2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
  2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
  2023-04-27 23:05 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 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:6930165acd05c8eef88a99b9546742b108e0c84e

commit r11-10656-g6930165acd05c8eef88a99b9546742b108e0c84e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Feb 27 22:34:57 2023 +0000

    libstdc++: Fix uses_allocator_construction_args for pair<T&&, U&&>
[PR108952]

    This implements LWG 3527 which fixes the handling of pair<T&&, U&&> in
    std::uses_allocator_construction_args.

    libstdc++-v3/ChangeLog:

            PR libstdc++/108952
            * include/bits/uses_allocator_args.h
            (uses_allocator_construction_args): Implement LWG 3527.
            * testsuite/20_util/pair/astuple/get-2.cc: New test.
            * testsuite/20_util/scoped_allocator/108952.cc: New test.
            * testsuite/20_util/uses_allocator/lwg3527.cc: New test.

    (cherry picked from commit 8e342c04550466ab088c33746091ce7f3498ee44)

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

* [Bug libstdc++/108952] [10/11 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (11 preceding siblings ...)
  2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
  2023-04-27 23:05 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-27 23:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 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:bd0179f31dfb9b009cb561d336f3f1c6fbdd4ceb

commit r10-11319-gbd0179f31dfb9b009cb561d336f3f1c6fbdd4ceb
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Feb 27 22:34:57 2023 +0000

    libstdc++: Fix uses_allocator_construction_args for pair<T&&, U&&>
[PR108952]

    This implements LWG 3527 which fixes the handling of pair<T&&, U&&> in
    std::uses_allocator_construction_args.

    libstdc++-v3/ChangeLog:

            PR libstdc++/108952
            * include/std/memory (uses_allocator_construction_args):
            Implement LWG 3527.
            * testsuite/20_util/pair/astuple/get-2.cc: New test.
            * testsuite/20_util/scoped_allocator/108952.cc: New test.
            * testsuite/20_util/uses_allocator/lwg3527.cc: New test.

    (cherry picked from commit 8e342c04550466ab088c33746091ce7f3498ee44)

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

* [Bug libstdc++/108952] [10/11 Regression] Regression in uses_allocator_construction_args for pair of rvalue references
  2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
                   ` (12 preceding siblings ...)
  2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
@ 2023-04-27 23:05 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-27 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 12.3, 11.4 and 10.5

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

end of thread, other threads:[~2023-04-27 23:05 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 16:14 [Bug libstdc++/108952] New: Regression in uses_allocator_construction_args for pair of rvalue references christian.mazakas at gmail dot com
2023-02-27 16:15 ` [Bug libstdc++/108952] " pinskia at gcc dot gnu.org
2023-02-27 17:03 ` redi at gcc dot gnu.org
2023-02-27 17:18 ` rs2740 at gmail dot com
2023-02-27 17:33 ` pdimov at gmail dot com
2023-02-27 17:34 ` redi at gcc dot gnu.org
2023-02-27 21:27 ` [Bug libstdc++/108952] [10/11/12/13 Regression] " redi at gcc dot gnu.org
2023-02-28  9:50 ` cvs-commit at gcc dot gnu.org
2023-02-28  9:53 ` [Bug libstdc++/108952] [10/11/12 " redi at gcc dot gnu.org
2023-02-28 10:40 ` rguenth at gcc dot gnu.org
2023-04-27 14:44 ` cvs-commit at gcc dot gnu.org
2023-04-27 14:52 ` [Bug libstdc++/108952] [10/11 " redi at gcc dot gnu.org
2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
2023-04-27 23:05 ` 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).