public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/90745] [9/10 Regression] std::tuple::operator= parameter causes error outside immediate context
       [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-12 11:58 ` jakub at gcc dot gnu.org
  2021-04-19 10:40 ` [Bug libstdc++/90745] [9/10/11 " redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-12 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.3                         |9.4

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 9.3.0 has been released, adjusting target milestone.

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

* [Bug libstdc++/90745] [9/10/11 Regression] std::tuple::operator= parameter causes error outside immediate context
       [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
  2020-03-12 11:58 ` [Bug libstdc++/90745] [9/10 Regression] std::tuple::operator= parameter causes error outside immediate context jakub at gcc dot gnu.org
@ 2021-04-19 10:40 ` redi at gcc dot gnu.org
  2021-06-01  8:14 ` [Bug libstdc++/90745] [9/10/11/12 " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-19 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|redi at gcc dot gnu.org            |unassigned at gcc dot gnu.org

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

* [Bug libstdc++/90745] [9/10/11/12 Regression] std::tuple::operator= parameter causes error outside immediate context
       [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
  2020-03-12 11:58 ` [Bug libstdc++/90745] [9/10 Regression] std::tuple::operator= parameter causes error outside immediate context jakub at gcc dot gnu.org
  2021-04-19 10:40 ` [Bug libstdc++/90745] [9/10/11 " redi at gcc dot gnu.org
@ 2021-06-01  8:14 ` rguenth at gcc dot gnu.org
  2022-05-27  9:40 ` [Bug libstdc++/90745] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug libstdc++/90745] [10/11/12/13 Regression] std::tuple::operator= parameter causes error outside immediate context
       [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-06-01  8:14 ` [Bug libstdc++/90745] [9/10/11/12 " rguenth at gcc dot gnu.org
@ 2022-05-27  9:40 ` rguenth at gcc dot gnu.org
  2022-06-28 10:37 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug libstdc++/90745] [10/11/12/13 Regression] std::tuple::operator= parameter causes error outside immediate context
       [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-05-27  9:40 ` [Bug libstdc++/90745] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:37 ` jakub at gcc dot gnu.org
  2023-07-07 10:35 ` [Bug libstdc++/90745] [11/12/13/14 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug libstdc++/90745] [11/12/13/14 Regression] std::tuple::operator= parameter causes error outside immediate context
       [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-06-28 10:37 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:35 ` rguenth at gcc dot gnu.org
  2024-03-27 12:10 ` redi at gcc dot gnu.org
  2024-03-27 12:12 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

* [Bug libstdc++/90745] [11/12/13/14 Regression] std::tuple::operator= parameter causes error outside immediate context
       [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2023-07-07 10:35 ` [Bug libstdc++/90745] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-03-27 12:10 ` redi at gcc dot gnu.org
  2024-03-27 12:12 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2024-03-27 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Slightly reduced:

#include <tuple>

template <class Op, class P0, class P1>
struct Expr
{
    Op op;
    std::tuple<P0, P1> t;

    using R = decltype(op(*(std::get<0>(t).p), *(std::get<1>(t).p)));
    operator R() { return op(*(std::get<0>(t).p), *(std::get<1>(t).p)); }
};

template <class Op, class P0, class P1> inline auto
expr(Op && op, P0 && p0, P1 && p1)
{
    return Expr<Op, P0, P1> { op, { p0, p1 } };
}

template <class T>
struct cell
{
    T * p = nullptr;

    template <class X> decltype(auto) operator =(X && x)
    {
        expr([](auto && y, auto && x)
                 {
                     y = x;
                 },
            *this, x);
    }
};

int main()
{
  cell<int> n;
  cell<int const> c;
  n = c;
}


I think GCC is correct to reject this, other compilers agree.

Overload resolution for 'n = c' considers cell<int>::operator=(X&&) as well as
cell's implicit assignment ops, but it _also_ considers cell<int
const>::operator=(X&&) due to ADL.

Because that overload has a decltype(auto) return type it has to instantiate
the body, which instantiates Expr<lambda, cell<int const>, cell<int const>>
which triggers the error in the std::tuple::operator= outside the immediate
context.

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

* [Bug libstdc++/90745] [11/12/13/14 Regression] std::tuple::operator= parameter causes error outside immediate context
       [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2024-03-27 12:10 ` redi at gcc dot gnu.org
@ 2024-03-27 12:12 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2024-03-27 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Replacing delctype(auto) on the cell::operator=(X&&) function (or constraining
that function to not be instantiated for non-assignable cells) will fix the
code.

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

end of thread, other threads:[~2024-03-27 12:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-90745-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 11:58 ` [Bug libstdc++/90745] [9/10 Regression] std::tuple::operator= parameter causes error outside immediate context jakub at gcc dot gnu.org
2021-04-19 10:40 ` [Bug libstdc++/90745] [9/10/11 " redi at gcc dot gnu.org
2021-06-01  8:14 ` [Bug libstdc++/90745] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-05-27  9:40 ` [Bug libstdc++/90745] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:37 ` jakub at gcc dot gnu.org
2023-07-07 10:35 ` [Bug libstdc++/90745] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-03-27 12:10 ` redi at gcc dot gnu.org
2024-03-27 12:12 ` 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).