Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which guarantees does the C++ standard have when it comes to issuing diagnostic messages?

While reading the C++ standard, one often sees designations like "... ill-formed, no diagnostic required". A (random) example can be found in 13.8.1/17:

The class S1::Inner1 is ill-formed, no diagnostic required, because it has no valid specializations.

Where can one find an opposite normative language in the standard, which would prescribe a diagnostic for an ill-formed program?

like image 953
SergeyA Avatar asked Jul 10 '19 13:07

SergeyA


1 Answers

What you are looking for is [intro.compliance]/1

The set of diagnosable rules consists of all syntactic and semantic rules in this document except for those rules containing an explicit notation that “no diagnostic is required” or which are described as resulting in “undefined behavior”.

It is then followed up with [intro.compliance]/2

If a program contains a violation of any diagnosable rule or an occurrence of a construct described in this document as “conditionally-supported” when the implementation does not support that construct, a conforming implementation shall issue at least one diagnostic message.

which guarantees that if you break one of the diagnosable rules you'll get a diagnostic message.

like image 60
NathanOliver Avatar answered Nov 15 '22 22:11

NathanOliver