C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: MSVC issue with name lookup in user-defined deduction guide
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2021-06-22 12:30:04


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.


STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups