* [Bug c++/103783] Ambiguous overload between constrained static member and unconstrained non-static member
2021-12-21 1:39 [Bug c++/103783] New: Ambiguous overload between constrained static member and unconstrained non-static member barry.revzin at gmail dot com
@ 2021-12-21 1:50 ` pinskia at gcc dot gnu.org
2022-01-02 5:40 ` fchelnokov at gmail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-21 1:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103783
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2021-12-21
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, the constraint on f does not even need to be depdent to the
incorrect behavior from GCC:
int sc();
int mc();
template<int>
struct s {
void f() const {mc();}
static void f() requires true {sc();}
};
void g() {
s<0>().f();
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103783] Ambiguous overload between constrained static member and unconstrained non-static member
2021-12-21 1:39 [Bug c++/103783] New: Ambiguous overload between constrained static member and unconstrained non-static member barry.revzin at gmail dot com
2021-12-21 1:50 ` [Bug c++/103783] " pinskia at gcc dot gnu.org
@ 2022-01-02 5:40 ` fchelnokov at gmail dot com
2022-01-02 16:57 ` davidfromonline at gmail dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: fchelnokov at gmail dot com @ 2022-01-02 5:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103783
Fedor Chelnokov <fchelnokov at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fchelnokov at gmail dot com
--- Comment #2 from Fedor Chelnokov <fchelnokov at gmail dot com> ---
I think this code is invalid per
https://timsong-cpp.github.io/cppwp/n4861/class.static.mfct#2:
> There shall not be a static and a non-static member function with the same name and the same parameter types ([over.load]).
So GCC just prints confusing diagnostics here, while it shall reject the
definition of `struct` with static and not-static `f`.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103783] Ambiguous overload between constrained static member and unconstrained non-static member
2021-12-21 1:39 [Bug c++/103783] New: Ambiguous overload between constrained static member and unconstrained non-static member barry.revzin at gmail dot com
2021-12-21 1:50 ` [Bug c++/103783] " pinskia at gcc dot gnu.org
2022-01-02 5:40 ` fchelnokov at gmail dot com
@ 2022-01-02 16:57 ` davidfromonline at gmail dot com
2022-01-02 19:23 ` davidfromonline at gmail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: davidfromonline at gmail dot com @ 2022-01-02 16:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103783
--- Comment #3 from David Stone <davidfromonline at gmail dot com> ---
Fedor, it looks like that wording was changed to a non-normative note and
expanded in N4868 to say: "There cannot be a static and a non-static member
function with the same name, parameter-type-list, and trailing requires-clause
([over.load]).". https://timsong-cpp.github.io/cppwp/n4868/class.static.mfct#2.
Later versions of the standard (for C++23) removed the sentence entirely.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103783] Ambiguous overload between constrained static member and unconstrained non-static member
2021-12-21 1:39 [Bug c++/103783] New: Ambiguous overload between constrained static member and unconstrained non-static member barry.revzin at gmail dot com
` (2 preceding siblings ...)
2022-01-02 16:57 ` davidfromonline at gmail dot com
@ 2022-01-02 19:23 ` davidfromonline at gmail dot com
2022-01-04 18:08 ` ppalka at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: davidfromonline at gmail dot com @ 2022-01-02 19:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103783
--- Comment #4 from David Stone <davidfromonline at gmail dot com> ---
A correction to my previous comment: n4868 is technically a C++23 working draft
(but claims to have only editorial fixes to the C++20 paper). However, I
believe the wording fixes to this section are intended to be a bug fix for
wording that was not updated when we added concepts and thus is the intended
C++20 behavior.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103783] Ambiguous overload between constrained static member and unconstrained non-static member
2021-12-21 1:39 [Bug c++/103783] New: Ambiguous overload between constrained static member and unconstrained non-static member barry.revzin at gmail dot com
` (3 preceding siblings ...)
2022-01-02 19:23 ` davidfromonline at gmail dot com
@ 2022-01-04 18:08 ` ppalka at gcc dot gnu.org
2022-01-10 19:59 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-04 18:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103783
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103783] Ambiguous overload between constrained static member and unconstrained non-static member
2021-12-21 1:39 [Bug c++/103783] New: Ambiguous overload between constrained static member and unconstrained non-static member barry.revzin at gmail dot com
` (4 preceding siblings ...)
2022-01-04 18:08 ` ppalka at gcc dot gnu.org
@ 2022-01-10 19:59 ` cvs-commit at gcc dot gnu.org
2022-01-10 21:16 ` cvs-commit at gcc dot gnu.org
2022-01-10 21:17 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-10 19:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103783
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:3e95a974c39e922d19bf7ac1246730c516ae01f2
commit r12-6424-g3e95a974c39e922d19bf7ac1246730c516ae01f2
Author: Patrick Palka <ppalka@redhat.com>
Date: Mon Jan 10 14:57:51 2022 -0500
c++: "more constrained" vs staticness of memfn [PR103783]
Here we're rejecting the calls to g1 and g2 as ambiguous even though one
overload is more constrained than the other (and they're otherwise tied),
because the implicit 'this' parameter of the non-static overload causes
cand_parms_match to think the function parameter lists aren't equivalent.
This patch fixes this by making cand_parms_match skip over 'this'
appropriately. Note that this bug only affects partial ordering of
non-template member functions because for member function templates
more_specialized_fn seems to already skip over 'this' appropriately.
PR c++/103783
gcc/cp/ChangeLog:
* call.c (cand_parms_match): Skip over 'this' when given one
static and one non-static member function.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-memfun2.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103783] Ambiguous overload between constrained static member and unconstrained non-static member
2021-12-21 1:39 [Bug c++/103783] New: Ambiguous overload between constrained static member and unconstrained non-static member barry.revzin at gmail dot com
` (5 preceding siblings ...)
2022-01-10 19:59 ` cvs-commit at gcc dot gnu.org
@ 2022-01-10 21:16 ` cvs-commit at gcc dot gnu.org
2022-01-10 21:17 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-10 21:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103783
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:1e4a9f22ac21da012fc93198a22e30b70e8fdf84
commit r11-9450-g1e4a9f22ac21da012fc93198a22e30b70e8fdf84
Author: Patrick Palka <ppalka@redhat.com>
Date: Mon Jan 10 14:57:51 2022 -0500
c++: "more constrained" vs staticness of memfn [PR103783]
Here we're rejecting the calls to g1 and g2 as ambiguous even though one
overload is more constrained than the other (and they're otherwise tied),
because the implicit 'this' parameter of the non-static overload causes
cand_parms_match to think the function parameter lists aren't equivalent.
This patch fixes this by making cand_parms_match skip over 'this'
appropriately. Note that this bug only affects partial ordering of
non-template member functions because for member function templates
more_specialized_fn seems to already skip over 'this' appropriately.
PR c++/103783
gcc/cp/ChangeLog:
* call.c (cand_parms_match): Skip over 'this' when given one
static and one non-static member function.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-memfun2.C: New test.
(cherry picked from commit 3e95a974c39e922d19bf7ac1246730c516ae01f2)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103783] Ambiguous overload between constrained static member and unconstrained non-static member
2021-12-21 1:39 [Bug c++/103783] New: Ambiguous overload between constrained static member and unconstrained non-static member barry.revzin at gmail dot com
` (6 preceding siblings ...)
2022-01-10 21:16 ` cvs-commit at gcc dot gnu.org
@ 2022-01-10 21:17 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-10 21:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103783
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |11.3
Status|ASSIGNED |RESOLVED
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.3/12
^ permalink raw reply [flat|nested] 9+ messages in thread