Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 6.7.2 variable templates
#1
Is the following considered to be compliant:

Code:
template <typename T>
T var = 42;


By itself it seems not to be in the spirit of the rule since there's no "const" in the declaration.  But what if the only instantiation is something like:

Code:
int foo() { return var<const int>; }

Thank you.
Reply


Messages In This Thread
Rule 6.7.2 variable templates - by gdavis - 24-07-2025, 06:55 PM
RE: Rule 6.7.2 variable templates - by misra cpp - 01-08-2025, 11:49 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)