Skip to content

Fix double counting in constexpr call depth [GH #178] - #244

Open
mborland wants to merge 4 commits into
edgcpp:mainfrom
mborland:fix/178
Open

mborland wants to merge 4 commits into
edgcpp:mainfrom
mborland:fix/178

Conversation

@mborland

@mborland mborland commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

The call-depth cost is now charged after the arguments are evaluated. Previously in an evaluation like add(1, f(n-1)) the call to add was charged while f(n-1) was still being evaluated so each level of recursion was double counted.

Closes: #178

@mborland mborland added the bug Something isn't working label Oct 8, 2026

@daveedvdv-nvidia daveedvdv-nvidia left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor test organization request.

Comment thread tests/tests/regressions/gh-178.sft.cpp
@daveedvdv-nvidia

daveedvdv-nvidia commented Oct 8, 2026 •

Copy link
Copy Markdown

This looks generally okay for me. I'd just split the tests in a positive and negative test file. (Or: Single test file with -DPOS and/or -DNEG options.)

@mborland

mborland commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

This looks generally okay for me. I'd just split the tests in a positive and negative test file. (Or: Single test file with -DPOS and/or -DNEG options.)

The tests are now in two files; one for positive and one for negative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

constexpr call depth counts calls whose arguments are still being evaluated

2 participants