Skip to content

Latest commit

 

History

History
177 lines (94 loc) · 9.66 KB

templates.md

File metadata and controls

177 lines (94 loc) · 9.66 KB
  • Flag algorithms with "overly simple" requirements, such as direct use of specific operators without a concept.
  • Do not flag the definition of the "overly simple" concepts themselves; they may simply be building blocks for more useful concepts.

no enforcement

  • Flag uses of void*s and casts outside low-level implementation code

see casting checks, but not directly enforced

  • Flag template type arguments without concepts

no enforcement

  • Look for unconstrained arguments, templates that use "unusual"/non-standard concepts, templates that use "homebrew" concepts without axioms.
  • Develop a concept-discovery tool (e.g., see an early experiment).

no enforcement

  • Not feasible in the short term when people convert from the and notation.
  • Later, flag declarations that first introduces a typename and then constrains it with a simple, single-type-argument concept.

no enforcement

  • Flag single-operation concepts when used outside the definition of other concepts.
  • Flag uses of enable_if that appears to simulate single-operation concepts.

no enforcement

  • Flag classes the support "odd" subsets of a set of operators, e.g., == but not != or + but not -. Yes, std::string is "odd", but it's too late to change that.

no enforcement

  • Look for the word "axiom" in concept definition comments

no enforcement

  • Flag a concept that has exactly the same requirements as another already-seen concept (neither is more refined). To disambiguate them, see T.24.

no enforcement

  • The compiler flags ambiguous use of identical concepts.
  • Flag the definition of identical concepts.

no enforcement

  • Flag pairs of functions with C and !C constraints

no enforcement

  • Flag pointer to function template arguments.
  • Flag pointers to functions passed as arguments to a template (risk of false positives).

no enforcement

  • Flag use of typename as a disambiguator outside using declarations.

no enforcement

  • Flag uses of typedef. This will give a lot of "hits" :-(

clang-tidy: modernize-use-using

  • Flag uses where an explicitly specialized type exactly matches the types of the arguments used.

no enforcement

  • Flag types that are not at least SemiRegular.

no enforcement

  • Flag templates defined in a namespace where concrete types are also defined (maybe not feasible until we have concepts).

no enforcement

  • Flag member types that do not depend on every template argument
  • Flag member functions that do not depend on every template argument

no enforcement

  • flag () initializers
  • flag function-style casts

no enforcement

  • In a template, flag an unqualified call to a nonmember function that passes a variable of dependent type when there is a nonmember function of the same name in the template's namespace.

no enforcement

  • Flag virtual functions that depend on a template argument. ??? False positives

no enforcement

  • Detect this horror!

no enforcement

  • Flag uses of va_arg in user code.

clang-tidy: cppcoreguidelines-pro-type-vararg

  • Flag template metaprograms yielding a value. These should be replaced with constexpr functions.

no enforcement

  • (hard) flag similar lambdas

codechecker has similarity check, otherwise no enforcement

  • Look for identical and near identical lambdas (to be replaced with named functions or named lambdas).

codechecker has similarity check, otherwise no enforcement

  • Flag comparison of iterators using < instead of !=.
  • Flag x.size() == 0 when x.empty() or x.is_empty() is available. Emptiness works for more containers than size(), because some containers don't know their size or are conceptually of unbounded size.
  • Flag functions that take a pointer or reference to a more-derived type but only use functions declared in a base type.

partial, clang-tidy: readability-container-size-empty

  • Flag all specializations of a function template. Overload instead.

no enforcement