Skip to content
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

Stop using std::is_trivial (deprecated in C++26) #1961

Open
dangelog opened this issue Dec 9, 2024 · 0 comments
Open

Stop using std::is_trivial (deprecated in C++26) #1961

dangelog opened this issue Dec 9, 2024 · 0 comments
Labels

Comments

@dangelog
Copy link

dangelog commented Dec 9, 2024

Hello,

The std::is_trivial type trait has been deprecated in C++26 by https://isocpp.org/files/papers/P3247R2.html ; some code in oneDPL is still using it, and needs to be ported away.

https://github.com/search?q=repo%3Aoneapi-src%2FoneDPL%20std::is_trivial&type=code

Note that I'm talking specifically about is_trivial and is_trivial_v, the other type traits are OK.

The direct (= semantically equivalent) non-deprecated replacement of is_trivial_v<T> would be to check for std::is_trivially_default_constructible_v<T> && std::is_trivially_copyable_v<T>.

However the ideal replacement is to reason about what exact type properties are needed, and test for those using specific type traits; for instance, check for trivial copy assignment, trivial destruction, and so on.

(The problem is that the definitions of trivial/trivially copyable encompass too much, and are inaccurate.)

Please also see the remarks to this mailing list thread for libstdc++: https://gcc.gnu.org/pipermail/libstdc++/2024-December/060119.html

Thanks,

@dangelog dangelog added the bug label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant