Closed
Description
Affected rules
A5-1-1
Description
Template instantiations with literal arguments can cause the creation of generated Literal
s in the program in two ways:
- If the template argument was a
constexpr
, we may generate aLiteral
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; }