-
-
Notifications
You must be signed in to change notification settings - Fork 264
Generated function specializations: Parameters generated from parameter packs use the same name #62
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
C++ Insights generates explicit specializations for template functions. When the primary function template contains any parameter packs, the parameters generated from the pack in the specialization will all use the same name. It would be nice for the names to be distinguished.
See below:
| Input | C++ Insights | Desired |
|---|---|---|
template<typename... T>
int func(T... t) {
return func(t...);
}
int _ = func(5, 5); |
#ifdef USE_TEMPLATE
template<>
int func<int, int>(int t, int t)
{
return func(t, t);
}
#endif
int _ = func(5, 5); |
#ifdef USE_TEMPLATE
template<>
int func<int, int>(int t1, int t2)
{
return func(t1, t2);
}
#endif
int _ = func(5, 5); |
Fixing this requires C++ Insights to detect which ParmVarDecls in a specialized FunctionDecl correspond to parameter packs in the primary function template (and then just suffix them with a counter, for instance). Annoyingly, I haven't found a good way in libclang to do so other than traversing all primary function template parameters and comparing them by name to the current ParmVarDecl :/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request