C++ Logo


Advanced search

Re: Conditional final class-virt-specifier

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Wed, 15 Jul 2020 16:35:09 -0400
On Wed, Jul 15, 2020 at 4:31 PM Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>

> On Wed, Jul 15, 2020 at 4:14 PM Paweł Benetkiewicz via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>> > No it doesn't. On none of the three major compilers does the code you've
>> posted compile. Seen here: https://gcc.godbolt.org/z/EEeMae
>> Wrong. It does, indeed. See here (MSVC 19.24):
>> https://godbolt.org/z/9Tb313
> Never take MSVC as your gold standard for anything involving templates.
> They historically didn't even *parse* templates until instantiation time.
> Since C++11, they've been forced to get a little better, but the
> implementation is still basically "don't parse the thing until you see a
> reason to do so." In this case, they're not parsing the `requires`-clause
> until instantiation time.
> MSVC still doesn't let you instantiate f<C>(), though. The syntax error is
> correctly detected at instantiation time.
> https://godbolt.org/z/Wvfa7W

Just to drive this point home (and because I know someone else will say it
if I don't):
The body of this function template is "syntax error syntax error" (with no
semicolon at the end). MSVC accepts it happily, because *MSVC doesn't parse



Received on 2020-07-15 15:38:36