Date: Fri, 20 Nov 2026 04:04:54 -0700
What's your use-case for needing to do "const A" and "A"? Also note
that "(const A, const A)" has the same function signature as "(A, A)",
though I suppose one might end up with "(const A, const A)" via
template expansion.
Compiler divergence isn't for this forum (std-proposals), this is
about discussing changes to the Standard.
On Fri, Nov 20, 2026 at 1:00 AM Anoop Rana via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> The bullet given at class.compare.default seems to make the following program invalid. I don't think this is the intention. That is, I think it should be valid but the current wording makes it invalid. We see compiler divergence here. Demo
>
> ```
> struct A {
>
> friend bool operator==(const A, A) = default; //gcc and edg ok but clang and msvc no
> };
>
> ```
> Similarly, we have another compiler divergence for the following program:
> ```
> struct A {
> friend bool operator==(const A, const A) = default;//clang no but gcc, msvc and edg ok
> };
>
> ```
> The bullet says:
>>
>> either has two parameters of type const C& or two parameters of type C, where the implicit object parameter (if any) is considered to be the first parameter.
>
>
> Moreover, there is a note in dcl.fct that says:
> > [Note 3: This transformation does not affect the types of the parameters. For example, int(*)(const int p, decltype(p)*) and int(*)(int, const int*) are identical types. — end note]
>
> This would mean that the above program is invalid. But I think this is an over/under sight as it makes sense to allow `const A, A` as parameters or even the case `const A, const A` also makes sense. Should this be a CWG issue or is this as it should be?
>
> Regards,
> Anoop S. Rana
> M.Sc Physics
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
that "(const A, const A)" has the same function signature as "(A, A)",
though I suppose one might end up with "(const A, const A)" via
template expansion.
Compiler divergence isn't for this forum (std-proposals), this is
about discussing changes to the Standard.
On Fri, Nov 20, 2026 at 1:00 AM Anoop Rana via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> The bullet given at class.compare.default seems to make the following program invalid. I don't think this is the intention. That is, I think it should be valid but the current wording makes it invalid. We see compiler divergence here. Demo
>
> ```
> struct A {
>
> friend bool operator==(const A, A) = default; //gcc and edg ok but clang and msvc no
> };
>
> ```
> Similarly, we have another compiler divergence for the following program:
> ```
> struct A {
> friend bool operator==(const A, const A) = default;//clang no but gcc, msvc and edg ok
> };
>
> ```
> The bullet says:
>>
>> either has two parameters of type const C& or two parameters of type C, where the implicit object parameter (if any) is considered to be the first parameter.
>
>
> Moreover, there is a note in dcl.fct that says:
> > [Note 3: This transformation does not affect the types of the parameters. For example, int(*)(const int p, decltype(p)*) and int(*)(int, const int*) are identical types. — end note]
>
> This would mean that the above program is invalid. But I think this is an over/under sight as it makes sense to allow `const A, A` as parameters or even the case `const A, const A` also makes sense. Should this be a CWG issue or is this as it should be?
>
> Regards,
> Anoop S. Rana
> M.Sc Physics
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-11-20 11:05:07
