cvalue and constant integral expression in generic context - Printable Version +- MISRA Discussion Forums ( https://forum.misra.org.uk)+-- Forum: MISRA C++ ( https://forum.misra.org.uk/forumdisplay.php?fid=18)+--- Forum: AUTOSAR C++:2014 rules ( https://forum.misra.org.uk/forumdisplay.php?fid=185)+--- Thread: cvalue and constant integral expression in generic context ( /showthread.php?tid=1675) |

cvalue and constant integral expression in generic context - gerbor - 12-03-2024
We would like to have some clarification regarding cvalues and integral constant expressions when considering C++14. Main Question: Is N, which is an integral constant expression, a cvalue as defined in MISRA C++:2008? Code: `template <typename T, int N>` Question 2: Does the use of {} or () have any affect on whether N is a cvalue? Question 3: Does it matter whether T is fundamental type or a class type? For example: Code: `template <typename T>` RE: cvalue and constant integral expression in generic context - misra cpp - 19-04-2024
From the definitions in MISRA 2008, integral constant expressions are never cvalues. As far as we can determine, your example code should be compliant, at least with respect to the use of cvalues. |