Skip to content

Remove std::pow from constexpr#291

Merged
davidscn merged 1 commit intoprecice:developfrom
mennodeij:patch-1
Aug 24, 2022
Merged

Remove std::pow from constexpr#291
davidscn merged 1 commit intoprecice:developfrom
mennodeij:patch-1

Conversation

@mennodeij
Copy link
Copy Markdown

using std::pow in a constexpr is not supported by Intel oneAPI C++ compiler:

rigid_body_solver.cpp(117): error: expression must have a constant value
    constexpr double inertia_moment = (1. / 12) * mass * (4 * std::pow(length, 2) + std::pow(height, 2));
                                      ^
/usr/include/c++/8/cmath(418): note: cannot call non-constexpr function "pow" (declared at line 140 of "/usr/include/bits/mathcalls.h")
        return pow(__type(__x), __type(__y));
               ^

This is not supported by Intel oneAPI C++ compiler:
```
rigid_body_solver.cpp(117): error: expression must have a constant value
    constexpr double inertia_moment = (1. / 12) * mass * (4 * std::pow(length, 2) + std::pow(height, 2));
                                      ^
/usr/include/c++/8/cmath(418): note: cannot call non-constexpr function "pow" (declared at line 140 of "/usr/include/bits/mathcalls.h")
        return pow(__type(__x), __type(__y));
               ^
```
Copy link
Copy Markdown
Member

@davidscn davidscn left a comment

Choose a reason for hiding this comment

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

Indeed, seems to be a gcc extension, thanks!

@davidscn davidscn merged commit b1c417c into precice:develop Aug 24, 2022
@mennodeij mennodeij deleted the patch-1 branch August 24, 2022 07:10
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