79564686

Date: 2025-04-09 15:07:48
Score: 0.5
Natty:
Report link

As @Marek R mentions in comments, the issue is with using constexpr for the the variables is_contain_move_stream and is_contain_compute_stream. For simple fix you can just use const instead. The variable result in main will still be computed at compile time.

The reason is that constexpr functions don't have to be called at compile time. If their arguments are not known at compile time, they behave in the same way as any other function. That is why you can't store the function argument in constexpr variable. The function needs to be valid both in constexpr and at runtime.

Another way to look at this problem is that the argument is not marked constexpr so it cannot be stored in constexpr variable (const and constexpr are very different). Function arguments cannot be marked as constexpr.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Marek
  • Low reputation (0.5):
Posted by: Bonny4