c++ - Multiple pack expansions inside class with fixed number of template arguments -


is code well-formed? declaration of function template gives error in both clang , gcc though ts empty.

// error: many template arguments class template 'pair' template<class i, class u, class... ts> void f(std::pair<i,u,ts...>);  int main() {     f(std::pair<int,int>()); } 

the function call gives error in gcc doesn't make sense. there no conversion int:

note: cannot convert 'std::pair<int, int>()' (type 'std::pair<int, int>') type 'int' 

[temp.res]/8:

if every valid specialization of variadic template requires empty template parameter pack, template ill-formed, no diagnostic required.

every valid specialization of f require ts empty pack. therefore program ill-formed ndr. both compilers correct.

as gcc's diagnostic, seems due habit of using int placeholder "something looks type doesn't make sense" error recovery purposes.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -