-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
For the following code
template<typename U, typename ...T>
void f(U, T... rest)
{
if constexpr (sizeof...(rest) != 0)
f(rest...);
}
int main()
{
f(0, 1);
}template<typename U, typename ...T>
void f(U, T... rest)
{
if constexpr (sizeof...(rest) != 0)
f(rest...);
}
/* First instantiated from: insights.cpp:10 */
#ifdef INSIGHTS_USE_TEMPLATE
template<>
void f<int, int>(int, int __rest1)
{
if constexpr(1 != 0) f(__rest1);
}
#endif
/* First instantiated from: insights.cpp:5 */
#ifdef INSIGHTS_USE_TEMPLATE
template<>
void f<int, >(int)
{
if constexpr(0 != 0) ;
}
#endif
int main()
{
f(0, 1);
}Note the trailing comma in the second instantiation:
template<>
void f<int, >(int)
^ hereRelevant parts of the AST for the first and second instantiations:
| |-FunctionDecl <line:2:1, line:6:1> line:2:6 used f 'void (int, int)'
| | |-TemplateArgument type 'int'
| | |-TemplateArgument pack
| | | `-TemplateArgument type 'int'
| | |-ParmVarDecl <col:8> col:9 'int':'int'
...
| `-FunctionDecl <line:2:1, line:6:1> line:2:6 used f 'void (int)'
| |-TemplateArgument type 'int'
| |-TemplateArgument pack
| |-ParmVarDecl <col:8> col:9 'int':'int'
...
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working