Skip to content

Don't translate constexpr functions to const fn - #352

Merged
nunoplopes merged 1 commit into
Cpp2Rust:masterfrom
lucic71:const-fn
Sep 10, 2026
Merged

nunoplopes merged 1 commit into
Cpp2Rust:masterfrom
lucic71:const-fn

Conversation

@lucic71

@lucic71 lucic71 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

In C++ constexpr can call non-constexpr functions. Rust does not allow calling non-const function in const fn. This includes user-defined non-const functions and std functions like .clone(), Rc::new(), etc.

@nunoplopes
nunoplopes merged commit b2e96e5 into Cpp2Rust:master Sep 10, 2026
9 checks passed
joaotgouveia pushed a commit to joaotgouveia/cpp2rust that referenced this pull request Oct 27, 2026
In C++ constexpr can call non-constexpr functions. Rust does not allow
calling non-const function in const fn. This includes user-defined
non-const functions and std functions like `.clone()`, `Rc::new()`, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants