C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: Question about name lookup and class member?
From: Andrew Schepler (aschepler_at_[hidden])
Date: 2021-06-08 05:23:37


On Tue, Jun 8, 2021 at 3:34 AM Eric Suen via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> That's why I call it weird bug coz it's obvious. MSVC won't report any
> error at that line with/without the comment.
>

Apparently MSVC allows any expression which looks like an unqualified
template-id in a default template argument, even with "/permissive-" set.
Being in a class doesn't even matter. If the default template argument is
never used, the identifier assumed to be a template-name doesn't even need
to appear anywhere else in the program. So it accepts things like:

template <class = A<void>::type, int = B<1>.M> void f();

This isn't exactly "weird bugs of compilers", though - MSVC is the only
compiler with this issue.



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

Older Archives on Google Groups