Skip to content

template template reportedly undefined #55642

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

Closed
uohmak4fvpqe opened this issue May 22, 2022 · 6 comments
Closed

template template reportedly undefined #55642

uohmak4fvpqe opened this issue May 22, 2022 · 6 comments
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@uohmak4fvpqe
Copy link

uohmak4fvpqe commented May 22, 2022

clang trunk (-std=c++20) fails on the following code :

#include<tuple>
#include<type_traits>

template<class>struct type_unpack;
    template<template<class/*...*/>class Pack,class T>struct type_unpack<Pack<T>>:std::type_identity<T>{};

static type_unpack<std::tuple<int>> t[[maybe_unused]];
int main(){
    return 0;
}
source>:7:37: error: implicit instantiation of undefined template 'type_unpack<std::tuple<int>>'

the fix I found is to add the .... GCC trunk compiles with or without the ellipsis.
Tested on godbolt

@EugeneZelenko EugeneZelenko added c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels May 22, 2022
@llvmbot
Copy link
Member

llvmbot commented May 22, 2022

@llvm/issue-subscribers-clang-frontend

@llvmbot
Copy link
Member

llvmbot commented May 22, 2022

@llvm/issue-subscribers-c-20

@dwblaikie
Copy link
Collaborator

Is it clear (some standards wording would be helpful) that this is a Clang rejects-valid, and not a GCC accepts-invalid?

I would be surprised if std::tuple<int> would match against template<class> class X - I'd expect to need the ... to match the template argument list there, but I don't know for sure/don't have spec wording to back that up.

@royjacobson
Copy link
Contributor

Is this another case of P0522? (#42305)

It compiles with the -frelaxed-template-template-args flag.

@uohmak4fvpqe
Copy link
Author

uohmak4fvpqe commented May 24, 2022

Is this another case of P0522? (#42305)

It compiles with the -frelaxed-template-template-args flag.

Indeed it does, thanks

@uohmak4fvpqe
Copy link
Author

uohmak4fvpqe commented May 24, 2022

Is it clear (some standards wording would be helpful) that this is a Clang rejects-valid, and not a GCC accepts-invalid?

I would be surprised if std::tuple<int> would match against template<class> class X - I'd expect to need the ... to match the template argument list there, but I don't know for sure/don't have spec wording to back that up.

cppreference does mention template<template<typename> class X>. I'm not surprised that putting an ellipsis in there matches any list of type parameters obvisously, but I expect to be able to constrain more, e.g thing like template<template<class,class,class> class X> that would only match things of arity 3 like std::tuple<char,int,void>

which is how it seems to work with -frelaxed-template-template-args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

5 participants