Simultaneous parameter pack expansion error for unused template type definition

AngelGabriel

The problem that I have encountered is the following warning from clang (c++14):

Pack expansion contains parameter pack 'v_seconds' that has a different length (3 vs. 1) from outer parameter packs

The issue is encountered in the following example code:

template<typename... v_firsts>
struct types_list {
    template<typename... v_seconds>
    using pairs_list = types_list<std::pair<v_firsts, v_seconds>...>;
};

using my_types_list = types_list<short, int, long>;

using my_pairs_list = my_types_list::pairs_list<short, int, long>; // GOOD

template<typename... v_pack>
using any_pairs_list = my_types_list::pairs_list<v_pack...>; // BAD

How I interpret the error is that somehow a specialization of any_pairs_list in which v_seconds has a length of 1 is encountered, and then naturally an error is encountered.

However the code above is the entire example code - I never use a specialization of any_pairs_list.

So, I have to conclude that a specialization is nevertheless created...

Now, the usual TMP forking question:

if (This an intentional behavior of the variadic syntax) {
    Can someone reference some documentation so that I can learn more?
} else if (This a known clang decision or problem) {
    Can someone reference some discussion?
} else {
    Can someone please name the issue / mistake?
}

P.S. I have tested using apple's installation of Clang (v8.1.0) and also with Visual Studio 2017 Clang extension. Unfortunately I don't have a linux environment to test in...

Columbo

My best guess is that Clang uses some type of heuristic to check for inherently uninstantiable templates. Perhaps it (spuriously) decides that there is one argument to the alias in any_pairs_list because it doesn't deal with pack expansions properly, and then substitutes some unique synthesized type to test whether that could work in principle. After all, you do get the exact same error message if you don't use a pack but just one bog-standard template parameter.

Reported as #32905.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

non type template parameter pack expansion

a variadic template as a template parameter without pack expansion

Variadic template variable parameter pack expansion in recursive variable definition has incorrect size

C++ template variable and parameter pack expansion

How to "duplicate" template parameter pack expansion?

Variadic template parameter pack expansion looses qualifier

Class template parameter pack expansion for constructors

C++ Parameter Pack type expansion

Type alias a template parameter pack

Definition of "pattern" for parameter pack expansion, especially within a function call

Can I use `enable_if` on a non-type template parameter pack inside the class definition?

Pack expansion for alias template

Variadic template pack expansion

Template pack expansion with functions

Clang fails to compile parameter pack expansion using template metaprogramming

template Parameter pack expansion on function call with array of data

Parameter pack expansion questions

Order of parameter pack expansion

Nested parameter pack expansion

when template parameter of a template template-parameter is pack expansion, gcc fails, clang succeeds

RAML API baseUriParameters unused template parameter error

c++ non-type parameter pack expansion

Check if a type is passed in variadic template parameter pack

Remove the last type of a template parameter pack

template of variadic template: parameter pack expects a type template

Variadic template indexed pack expansion

Is a parameter pack a template parameter?

Having trouble with parameter pack expansion

parameter pack expansion not working in lambda