public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context
@ 2022-02-09 19:40 ppalka at gcc dot gnu.org
  2022-02-09 20:12 ` [Bug c++/104476] [11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-02-09 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104476
           Summary: using-decl shadowed by member function when in
                    incomplete-class context
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

We reject the following valid testcase:

struct A {
  static void f();
};

struct B : A
{
  using A::f;         // #1
  static void f(int); // #2
  auto g() -> decltype(f());  // Call should be accepted via #1, instead
rejected
};

with

<stdin>:9:25: error: no matching function for call to ‘B::f()’
<stdin>:8:15: note: candidate: ‘static void B::f(int)’
<stdin>:8:15: note:   candidate expects 1 argument, 0 provided
<stdin>:9:25: error: no matching function for call to ‘B::f()’
<stdin>:8:15: note: candidate: ‘static void B::f(int)’
<stdin>:8:15: note:   candidate expects 1 argument, 0 provided

Yet if we swap the order of the declarations #1 and #2, then we accept the
testcase.

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

* [Bug c++/104476] [11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
@ 2022-02-09 20:12 ` pinskia at gcc dot gnu.org
  2022-02-09 20:25 ` ppalka at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-09 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.3.0, 4.9.0, 5.1.0
     Ever confirmed|0                           |1
            Summary|using-decl shadowed by      |[11/12 Regression]
                   |member function when in     |using-decl shadowed by
                   |incomplete-class context    |member function when in
                   |                            |incomplete-class context
   Target Milestone|---                         |11.3
           Keywords|                            |needs-bisection
      Known to fail|                            |11.2.0, 12.0, 4.4.7
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-02-09

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, a regression from GCC 10.x.

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

* [Bug c++/104476] [11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
  2022-02-09 20:12 ` [Bug c++/104476] [11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-02-09 20:25 ` ppalka at gcc dot gnu.org
  2022-02-09 20:36 ` [Bug c++/104476] [10/11/12 " ppalka at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-02-09 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=92918
           Keywords|needs-bisection             |

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Looks like it started with r11-8033.

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

* [Bug c++/104476] [10/11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
  2022-02-09 20:12 ` [Bug c++/104476] [11/12 Regression] " pinskia at gcc dot gnu.org
  2022-02-09 20:25 ` ppalka at gcc dot gnu.org
@ 2022-02-09 20:36 ` ppalka at gcc dot gnu.org
  2022-02-10  0:06 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-02-09 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression]          |[10/11/12 Regression]
                   |using-decl shadowed by      |using-decl shadowed by
                   |member function when in     |member function when in
                   |incomplete-class context    |incomplete-class context

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #2)
> Looks like it started with r11-8033.

which has also been backported as r10-9849.

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

* [Bug c++/104476] [10/11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-02-09 20:36 ` [Bug c++/104476] [10/11/12 " ppalka at gcc dot gnu.org
@ 2022-02-10  0:06 ` pinskia at gcc dot gnu.org
  2022-02-10  7:09 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-10  0:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/104476] [10/11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-02-10  0:06 ` pinskia at gcc dot gnu.org
@ 2022-02-10  7:09 ` rguenth at gcc dot gnu.org
  2022-02-17 22:58 ` jason at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-10  7:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Makes it P1 on the GCC 10 branch then given 10.3 worked.

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

* [Bug c++/104476] [10/11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-02-10  7:09 ` rguenth at gcc dot gnu.org
@ 2022-02-17 22:58 ` jason at gcc dot gnu.org
  2022-02-17 23:13 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2022-02-17 22:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/104476] [10/11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-02-17 22:58 ` jason at gcc dot gnu.org
@ 2022-02-17 23:13 ` cvs-commit at gcc dot gnu.org
  2022-02-17 23:14 ` [Bug c++/104476] [11/12 " jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-17 23:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

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

commit r10-10467-gb4e92ae2cacb0ef539326249fc59f790423a0766
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 17 18:11:23 2022 -0500

    Revert "c++: using overloaded with local decl [PR92918]"

           PR c++/104476

    This reverts commit decd38f99dd05eb54ddcaee7c52f21a56a844613.

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

* [Bug c++/104476] [11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-02-17 23:13 ` cvs-commit at gcc dot gnu.org
@ 2022-02-17 23:14 ` jason at gcc dot gnu.org
  2022-03-18 18:08 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2022-02-17 23:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |11.3
            Summary|[10/11/12 Regression]       |[11/12 Regression]
                   |using-decl shadowed by      |using-decl shadowed by
                   |member function when in     |member function when in
                   |incomplete-class context    |incomplete-class context

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

* [Bug c++/104476] [11/12 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2022-02-17 23:14 ` [Bug c++/104476] [11/12 " jason at gcc dot gnu.org
@ 2022-03-18 18:08 ` cvs-commit at gcc dot gnu.org
  2022-03-18 18:09 ` [Bug c++/104476] [11 " jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-18 18:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:47da5198766256be658b4c321cecfd6039b0b91b

commit r12-7714-g47da5198766256be658b4c321cecfd6039b0b91b
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Feb 25 15:07:15 2022 -0400

    c++: using lookup within class defn [PR104476]

    The problem in both PR92918 and PR104476 is overloading of base member
    functions brought in by 'using' with direct member functions during parsing
    of the class body.  To this point they've had a troublesome coexistence
    which was resolved by set_class_bindings when the class is complete, but we
    also need to handle lookup within the class body, such as in a trailing
    return type.

    The problem was that push_class_level_binding would either clobber the
    using-decl with the direct members or vice-versa.  In older versions of GCC
    we only pushed dependent usings, and preferring the dependent using made
    sense, as it expresses a type-dependent overload set that we can't do
    anything useful with.  But when we started keeping non-dependent usings
    around, push_class_level_binding in particular wasn't adjusted accordingly.

    This patch makes that adjustment, and pushes the functions imported by a
    non-dependent using immediately from finish_member_declaration.  This made
    diagnosing redundant using-decls a bit awkward, since we no longer push the
    using-decl itself; I handle that by noticing when we try to add the same
    function again and searching TYPE_FIELDS for the previous using-decl.

            PR c++/92918
            PR c++/104476

    gcc/cp/ChangeLog:

            * class.cc (add_method): Avoid adding the same used function twice.
            (handle_using_decl): Don't add_method.
            (finish_struct): Don't using op= if we have one already.
            (maybe_push_used_methods): New.
            * semantics.cc (finish_member_declaration): Call it.
            * name-lookup.cc (diagnose_name_conflict): No longer static.
            (push_class_level_binding): Revert 92918 patch, limit
            to dependent using.
            * cp-tree.h: Adjust.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/pr85070.C: Remove expected error.
            * g++.dg/lookup/using66a.C: New test.
            * g++.dg/lookup/using67.C: New test.

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

* [Bug c++/104476] [11 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2022-03-18 18:08 ` cvs-commit at gcc dot gnu.org
@ 2022-03-18 18:09 ` jason at gcc dot gnu.org
  2022-04-07  8:38 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2022-03-18 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression]          |[11 Regression] using-decl
                   |using-decl shadowed by      |shadowed by member function
                   |member function when in     |when in incomplete-class
                   |incomplete-class context    |context
      Known to fail|12.0                        |
      Known to work|                            |12.0

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 12 so far.

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

* [Bug c++/104476] [11 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2022-03-18 18:09 ` [Bug c++/104476] [11 " jason at gcc dot gnu.org
@ 2022-04-07  8:38 ` rguenth at gcc dot gnu.org
  2022-04-12 20:18 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-07  8:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |11.1.0
           Priority|P1                          |P2

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Reverted on the 10 branch, P2 on the 11 branch.

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

* [Bug c++/104476] [11 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2022-04-07  8:38 ` rguenth at gcc dot gnu.org
@ 2022-04-12 20:18 ` jason at gcc dot gnu.org
  2022-04-21  7:51 ` rguenth at gcc dot gnu.org
  2022-05-13 15:35 ` jason at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-12 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
I'm not sure whether it makes more sense to revert the PR92918 patch on the 11
branch or leave it alone; the GCC 12 fix is too complex to backport.  I guess I
lean toward leaving it alone, since this hasn't gotten other reports.

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

* [Bug c++/104476] [11 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2022-04-12 20:18 ` jason at gcc dot gnu.org
@ 2022-04-21  7:51 ` rguenth at gcc dot gnu.org
  2022-05-13 15:35 ` jason at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |11.4

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

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

* [Bug c++/104476] [11 Regression] using-decl shadowed by member function when in incomplete-class context
  2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2022-04-21  7:51 ` rguenth at gcc dot gnu.org
@ 2022-05-13 15:35 ` jason at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-13 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|11.4                        |12.0
         Resolution|---                         |FIXED

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #9)
> I guess I lean toward leaving it alone, since this hasn't gotten other reports.

So, closing.

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

end of thread, other threads:[~2022-05-13 15:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 19:40 [Bug c++/104476] New: using-decl shadowed by member function when in incomplete-class context ppalka at gcc dot gnu.org
2022-02-09 20:12 ` [Bug c++/104476] [11/12 Regression] " pinskia at gcc dot gnu.org
2022-02-09 20:25 ` ppalka at gcc dot gnu.org
2022-02-09 20:36 ` [Bug c++/104476] [10/11/12 " ppalka at gcc dot gnu.org
2022-02-10  0:06 ` pinskia at gcc dot gnu.org
2022-02-10  7:09 ` rguenth at gcc dot gnu.org
2022-02-17 22:58 ` jason at gcc dot gnu.org
2022-02-17 23:13 ` cvs-commit at gcc dot gnu.org
2022-02-17 23:14 ` [Bug c++/104476] [11/12 " jason at gcc dot gnu.org
2022-03-18 18:08 ` cvs-commit at gcc dot gnu.org
2022-03-18 18:09 ` [Bug c++/104476] [11 " jason at gcc dot gnu.org
2022-04-07  8:38 ` rguenth at gcc dot gnu.org
2022-04-12 20:18 ` jason at gcc dot gnu.org
2022-04-21  7:51 ` rguenth at gcc dot gnu.org
2022-05-13 15:35 ` jason 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).