-
Couldn't load subscription status.
- Fork 70
Open
Labels
@lcartey
Description
Affected rules
A7-1-2
Description
We should only report a variable in a template as a candidate for adding constexpr if all visible instantiations could use constexpr.
Example
int x; constexpr int* init_t(int i) { return &x; } float* init_t(float f) { return new float(); } template <typename T> void constexpr_variable_template() { constexpr T t1{}; T* t = init_t(t1); // COMPLIANT[FALSE_POSITIVE] for int, this could be constexpr, but not for float } void test() { constexpr_variable_template<int>(); constexpr_variable_template<float>(); }
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Triaged