Skip to content

[cuBLAS][rocBLAS] Fix uninstantiated template static asserts for older compilers #651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

rafbiels
Copy link
Contributor

CWG2518 allowing static_assert(false) in uninstantiated template is a C++23 behaviour that happens to work regardless of -std flag in recent compilers (clang >= 17) including DPC++. However, AdaptiveCpp is based on an older clang version and does not support that.

Force the static assert evaluation to be pushed after template evaluations by using type T inside the expression. This works in all supported compilers. Also add a message in the assert to clarify why it's there.

Credits to @DuncanMcBain for the solution.

Fixes #617

…r compilers

CWG2518 allowing static_assert(false) in uninstantiated template is a C++23
behaviour that happens to work regardless of -std flag in recent compilers
(clang >= 17) including DPC++. However, AdaptiveCpp is based on an older clang
version and does not support that.

Force the static assert evaluation to be pushed after template evaluations
by using type T inside the expression. This works in all supported compilers.

Also add a message in the assert to clarify why it's there.
@rafbiels rafbiels requested a review from a team as a code owner March 19, 2025 15:56
@sknepper
Copy link
Contributor

/intelci: run

Copy link
Contributor

@Rbiessy Rbiessy left a comment

Choose a reason for hiding this comment

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

LGTM. The pre-commit failure is unrelated.

@Rbiessy
Copy link
Contributor

Rbiessy commented Mar 27, 2025

@sknepper since you commented on the PR do you want to give the second approval?

Copy link
Contributor

@sknepper sknepper left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @rafbiels !

@sknepper sknepper merged commit 710934d into uxlfoundation:develop Mar 27, 2025
7 of 8 checks passed
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.

Build Process Error for AdaptiveCpp
3 participants