[intro.compliance.general] (original) (raw)
4 General principles [intro]
4.1 Implementation compliance [intro.compliance]
4.1.1 General [intro.compliance.general]
The set ofdiagnosable rulesconsists 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”.
Although this document states only requirements on C++ implementations, those requirements are often easier to understand if they are phrased as requirements on programs, parts of programs, or execution of programs.
Such requirements have the following meaning:
- If a program contains no violations of the rules in[lex] through [exec] as well as those specified in [depr], a conforming implementation shall accept and correctly execute3that program, except when the implementation's limitations (see below) are exceeded.
- If a program contains a violation of a rule for which no diagnostic is required, this document places no requirement on implementations with respect to that program.
- Otherwise, if a program contains
- a violation of any diagnosable rule,
- a preprocessing translation unit with a #warning preprocessing directive ([cpp.error]),
- an occurrence of a construct described in this document as “conditionally-supported” when the implementation does not support that construct, or
- a contract assertion ([basic.contract.eval]) evaluated with a checking semantic in a manifestly constant-evaluated context ([expr.const]) resulting in a contract violation,
a conforming implementation shall issue at least one diagnostic message.
[Note 1:
During template argument deduction and substitution, certain constructs that in other contexts require a diagnostic are treated differently; see [temp.deduct].
— _end note_]
Furthermore, a conforming implementation shall not accept
- a preprocessing translation unit containing a #error preprocessing directive ([cpp.error]),
- a translation unit with a static_assert-declaration that fails ([dcl.pre]), or
- a contract assertion evaluated with a terminating semantic ([basic.contract.eval]) in a manifestly constant-evaluated context ([expr.const]) resulting in a contract violation.
For classes and class templates, the library Clauses specify partial definitions.
Private members are not specified, but each implementation shall supply them to complete the definitions according to the description in the library Clauses.
For functions, function templates, objects, and values, the library Clauses specify declarations.
Implementations shall supply definitions consistent with the descriptions in the library Clauses.
A C++ translation unit ([lex.phases]) obtains access to the names defined in the library by including the appropriate standard library header or importing the appropriate standard library named header unit ([using.headers]).
The templates, classes, functions, and objects in the library have external linkage.
The implementation provides definitions for standard library entities, as necessary, while combining translation units to form a complete C++ program ([lex.phases]).
An implementation is either ahosted implementation or afreestanding implementation.
A freestanding implementation is one in which execution may take place without the benefit of an operating system.
A hosted implementation supports all the facilities described in this document, while a freestanding implementation supports the entire C++ language described in [lex] through [cpp] and the subset of the library facilities described in [compliance].
It isimplementation-defined whether the implementation is ahardened implementation.
If it is a hardened implementation, violating a hardened precondition results in a contract violation ([structure.specifications]).
An implementation is encouraged to document its limitations in the size or complexity of the programs it can successfully process, if possible and where known.
[implimits] lists some quantities that can be subject to limitations and a potential minimum supported value for each quantity.
A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any well-formed program.
Implementations are required to diagnose programs that use such extensions that are ill-formed according to this document.
Having done so, however, they can compile and execute such programs.
Each implementation shall include documentation that identifies all conditionally-supported constructsthat it does not support and defines all locale-specific characteristics.4