r/cpp • u/drop-volley • Sep 22 '26
Stateful compile-time functions
In section 9.1.2 of this book[1] it mentions that C++23 allows for stateful constexpr functions, and even shows an example. I can't seem to get it to compile on godbolt. Is the book completely wrong about something so fundamental, or am I doing something wrong?
[1] https://simplifycpp.org/books/cpp/Mastering_Modern_C++23_A_Complete_Guide_to_the_Latest_Standard.pdf
Edit: Godbolt link with code from that section -> https://godbolt.org/z/94j9EK87b
0
Upvotes
View all comments
Show parent comment
2
u/drop-volley Sep 22 '26
I added a Godbolt link. I figured this was the right subreddit because it's a language feature question, but I realize now that I was wrong. My bad.