Date: Tue, 8 Jun 2021 06:23:37 -0400
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_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.
Received on 2021-06-08 05:23:51