C++ Logo

std-discussion

Advanced search

Re: MSVC issue with name lookup in user-defined deduction guide

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 22 Jun 2021 20:30:04 +0300
On Tue, 22 Jun 2021 at 20:23, Hani Deek via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> I filed a bug report to MSVC about the code sample in this link https://godbolt.org/z/1nnxWhK4f
>
> It compiles without problems with GCC and Clang, but does not compile with MSVC.
>
> The link to the bug report that I submitted is https://developercommunity.visualstudio.com/t/Incorrect-name-lookup-in-user-defined-de/1456401.
>
> The answer that I received from Microsoft to the bug report is unclear, but apparently they say that their compiler is correct to refuse the code sample. It will compile only if you use the /permissive switch, which allows non-standard-conforming code to compile.
>
> I generally have low trust in what the MSVC people say on such matters, because in the past they dismissed some bug reports that I submitted without real basis. Apparently they just try to reduce their workload by arbitrarily dismissing some bug reports which they deem unimportant.
>
> The latest C++ standard says under [6.4.4] "If [a parameter-declaration-clause] P is associated with a deduction-guide, its scope extends to the end of the deduction-guide." Therefore, I believe the code should compile without the /permissive switch, isn't that correct?

Seems correct to me. I personally would, however, write the code so
that the question of how the naming clash is resolved never
arises, by not naming the parameter of the guide the same as a type or
alias in the surrounding scope. And when that is done,
the code is accepted by all compilers.

Received on 2021-06-22 12:30:20