No Diagnostic Required
From cppreference.com
"No diagnostic required" indicates that some phraseology is ill-formed according to the language rules, but a compiler need not issue any diagnostic or error message. Usually, the reason is that trying to detect these situations would result in prohibitively long compile times. Some things the standard marks as "ill-formed, no diagnostic required" are:
Contents |
Preprocessor
- If there are non-whitespace characters in a // comment between after either a form-feed or vertical-tab character and before the newline that terminates a comment
Identifiers
- A declaration whose literal-operator-id uses a literal suffix identifier
- Use of reserved identifier, such as one containing a double underscore __, one beginning with an underscore followed by an uppercase letter, or one in the global namespace beginning with an underscore.
- A program containing not exactly one definition of every non-inline function or variable that is odr-used in that program outside of a discarded statement.
Translation Units
- If the first declaration of a function or one of its parameters is declared with the carries_dependency attribute in one translation unit but missing the attribute in another
- If a function is declared with the noreturn attribute in one translation unit but missing the attribute in another
- If a function has different default arguments in different translation units.
- If a function template, member function of a class template, variable template, or static data member of a class template is not defined in every translation unit in which it is implicitly instantiated (unless the corresponding specialization is explicitly instantiated in some translation unit)
- If a function or variable with external or module linkage is declared inline in one translation unit, and there is not a reachable inline declaration in all translation units in which it is declared.
- For a given inline function declared in different translation units, if the accumulated sets of default arguments at the end of the translation units is different
- If an entity with C language linkage is declared with the same name as a variable in global scope, (unless both declarations denote the same entity) if the declarations appear in different translation units
- If declarations of an entity have different alignment specifiers in different translation units
Modules
- If there is more than one definition of an entity that is attached to a named module, unless a prior definition is reachable at a point where later definition appears.
- If multiple declarations of the same name with external linkage would declare the same entity except that they are attached to different modules
- If a module name beginning with std followed by zero or more digits or containing a reserved identifier is specified in a module-declaration
- If a named module contains not exactly one module interface unit (a module unit whose module-declaration contains the export keyword) with not module-partition
- If a name module contains multiple module partitions with the same module-partition, or not all module partitions of a module that are module interface units are directly or indirectly exported by the primary module interface unit.
- If a module unit with a private-module-fragment is not the only module unit of its module.
Templates
- If while parsing, a name in a template parameter is bound differently than it would be bound during a trial parse
- If the substitution of template arguments into a requirement would always result in a substitution failure
- If a template specialization is not visible at the point of instantiation, and it would have been selected had it been visible.
- If any substitution of the normal form of a concept-id for the concept’s respective template parameters in the parameter mappings in each
- Attempting to declare a void variable template
- If two different points of instantiation give a template specialization different meanings according to the one-definition rule.
- If the substitution into different declarations of the same function template would cause template instantiations to occur in a different order or not at all.
- If the no specialization of the template would satisfy the requirements for a constexpr function when considered as a non-template function.
- If no specialization of the template would satisfy the requirements for a constexpr function when considered as a non-template function
- For a constexpr function or constexpr constructor that is neither defaulted nor a template, if no argument values exist such that an invocation of the function or constructor could be an evaluated subexpression of a core constant expression, or, for a constructor, an evaluated subexpression of the initialization full-expression of some constant-initialized object.
- If the program does not provide a definition for an explicit specialization and either the specialization is used in a way that would cause an implicit instantiation to take place or the member is a virtual member function.
Ranges
- If the ranges::swap function selected by overload resolution does not exchange the two values
- If ranges::iter_move(E) is not equal to *E
- If the ranges::iter_swap function selected by overload resolution does not exchange the values
Classes
- If a constructor (either directly or indirectly) delegates to itself
- If a virtual function declared in a class is neither defined nor declared pure in that class
- If a name used in a class refers to a different declaration in its context and when re-evaluated in the completed scope of the class.
Memory
- If a program defines operator new or operator delete from header <new> and the declarations are inline
Misc
- If the semantic requirements of a declaration’s constraints are not modeled at the point of use
- If the rightmost parameter in the variable parameter pack expansion (right before the …) is a pack expansion or an entity resulting from a lambda capture
- If a function does not contain exactly one definition of every non-inline function or variable that is odr-used in that program outside of a discarded statement.
- If no constinit declaration is reachable at the point of the initializing declaration
- If two declarations declare functions with the same name and parameter-type-list to be members of the same namespace or declare objects with the same name to be members of the same namespace and the declarations give the names different language linkers