C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Conditional final class-virt-specifier
From: Arthur O'Dwyer (arthur.j.odwyer_at_[hidden])
Date: 2020-07-15 15:35:09


On Wed, Jul 15, 2020 at 4:31 PM Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
wrote:

> 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):
https://godbolt.org/z/hK99Gv
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
templates*.

–Arthur

>



STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups