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

<type_traits>: some traits are aliases and fail when used with parameter packs #4317

Closed
jonathanpoelen opened this issue Jan 14, 2024 · 1 comment · Fixed by #4318
Closed
Labels
bug Something isn't working fixed Something works now, yay!

Comments

@jonathanpoelen
Copy link

In an alias, a pack parameter cannot be used with a non-pack parameter and some traits fail in this case:

#include <type_traits>

template<class... xs>
using test = std::is_nothrow_convertible<xs...>; // error: pack expansion used as argument
                                                 // for non-pack parameter of alias template

std::is_nothrow_convertible<int,int> a; // ok
test<int,int> b; // fail

(https://godbolt.org/z/dTbWTYd4s)

From what I understand of cppreference and https://www.eel.is/c++draft/meta.type.synop, is_nothrow_convertible should be a class (who don't have this problem).

Expected behavior

The code above should compile.

STL version

msvc 19.37.32826.1 (sorry if this is not enough, I base this on what my github CI displays, but the main branch also uses aliases).

@frederick-vs-ja
Copy link
Contributor

Thanks for noting this. I think there're no other type trait class templates that are misimplemented as alias templates...

@StephanTLavavej StephanTLavavej added the bug Something isn't working label Jan 16, 2024
@StephanTLavavej StephanTLavavej changed the title <type_traits>: some traits are an aliases and fail when used with parameter pack <type_traits>: some traits are aliases and fail when used with parameter packs Jan 16, 2024
@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Something works now, yay!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants