C++ Logo


Advanced search

Remove non-type template limitations for consteval functions

From: Bastien penavayre <bastienpenava_at_[hidden]>
Date: Wed, 24 Feb 2021 13:01:11 +0100
Currently, non-type templates still have several limitations:
- must be structural (no private members)
- no allocations even if the type has a constexpr destructor
- can't contain floating point (double or float)
- can't hold strings of the "const char *" form
and so on...

These limitations have a good reason behind them for templated class and
function as they produce symbols in assembly and need to be resolved.

But as consteval functions never produce assembly/symbols and will never be
resolved by another translation unit than their own these restrictions
should be lifted.

What are your thoughts on this?
Am I missing something?

Thanks in advance,
Bastien Penavayre

Received on 2021-02-24 05:58:41