"Alf P. Steinbach" <
alf.p.s...@gmail.com> writes:
> On 13 Nov 2021 19:26, Tim Rentsch wrote:
>
>> "Alf P. Steinbach" <
alf.p.s...@gmail.com> writes:
>>
>> [...]
>>
>>> Ill formed program doesn't compile, and always causes a diagnostic.
>>
>> The C++ standard identifies several sets of circumstances that
>> cause a program to be ill formed, but explicitly and specifically
>> do not require a diagnostic.
>
> Oh you're right, thanks. Sorry.
No worries. Your description is mostly right, and in fact I
think it should _always_ be right. That there are exceptions
is IMO a flaw in how the C++ standard is written.
> I was talking about the in-practice but clearly some ill formed
> programs can't even practically be diagnosed as such.
>
> The difference between UB and ill-formed gets less clear then, but
> mainly that UB is well formed code that isn't constrained to any
> behavior, while ill formed code -- is code that isn't well formed
> and that isn't constrained to any behavior. A bit too circular
> for me. But I guess syntactically invalid code must be ill-formed
> and cannot have UB.
To be fair, any C++ construction that is ill-formed does require
a diagnostic, unless there is a specific statement that no
diagnostic is required. (Disclaimer: I am not 100% sure that
the previous sentence holds true in the case of violations of
the One Definition Rule.)