Affected rules
Description
Template instantiations with literal arguments can cause the creation of generated Literals in the program in two ways:
- If the template argument was a
constexpr, we may generate a Literal expression to represent the compiler-calculated value.
- If the template argument is used as an expression, we will generate a
Literal at that location to hold the value of the compiler-calculated value.
Example
#include <limits>
constexpr std::size_t dynamic_extent = std::numeric_limits<std::size_t>::max();
template <typename _Type, std::size_t _Extent = dynamic_extent> class span {
static constexpr std::size_t extent = _Extent;
};
void test_extent() { span<int> s; }
Affected rules
A5-1-1Description
Template instantiations with literal arguments can cause the creation of generated
Literals in the program in two ways:constexpr, we may generate aLiteralexpression to represent the compiler-calculated value.Literalat that location to hold the value of the compiler-calculated value.Example