CRefice
CRefice

Reputation: 430

How deeply nested can constexpr expressions be?

Considering a program is comprised entirely of constexpr functions (which are all capable of being computed at compile-time), is there a limit to how "levels" deep can constexpr functions be called? Could a whole program be computed at compile-time, given the right requisites, by using only constexpr functions?

Upvotes: 1

Views: 88

Answers (1)

Brian Bi
Brian Bi

Reputation: 119174

The standard recommends in Annex B a limit that is at least 512, but a conforming implementation need not comply with the recommendation.

— Recursive constexpr function invocations [512].

Upvotes: 6

Related Questions