Peter Nilsson said:
A constraint violation requires a diagnostic.
Correct, but to which constraint violation do you refer?
Undefined behavior and constraint violations are not the
same thing (see 5.1.1.3 below), which specifically
distinguishes between them.
============
ISO/IEC 9899:1999 (E)
3. Terms, definitions, and symbols
[...]
3.4.3
1 undefined behavior
behavior, upon use of a nonportable or erroneous program
construct or of erroneous data, for which this International
Standard imposes no requirements
2 NOTE Possible undefined behavior ranges from ignoring the
situation completely with unpredictable results, to behaving
during translation or program execution in a documented manner
characteristic of the environment (with or without the issuance
of a diagnostic message), to terminating a translation or
execution (with the issuance of a diagnostic message).
3 EXAMPLE An example of undefined behavior is the behavior on
integer overflow.
[...]
3.8
1 constraint
restriction, either syntactic or semantic, by which the
exposition of language elements is to be interpreted
[...]
5.1.1.3 Diagnostics
1 A conforming implementation shall produce at least one diagnostic
message (identified in an implementation-defined manner) if a
preprocessing translation unit or translation unit contains a
violation of any syntax rule or constraint, even if the behavior
is also explicitly specified as undefined or implementation-defined.
Diagnostic messages need not be produced in other circumstances.(8)
2 EXAMPLE An implementation shall issue a diagnostic for the
translation unit:
char i;
int i;
because in those cases where wording in this International Standard
describes the behavior for a construct as being both a constraint
error and resulting in undefined behavior, the constraint error shall
be diagnosed.
[...]
(8) The intent is that an implementation should identify the nature
of, and where possible localize, each violation. Of course, an
implementation is free to produce any number of diagnostics as long
as a valid program is still correctly translated. It may also
successfully translate an invalid program.
============
-Mike