Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does this code compile with gcc but not with clang

I believe that this code is incorrect. The function parameter to Log cannot be used for template argument deduction in this case because the argument is a non-deduced context.

From [temp.deduct.type] in the standard, p5 lists the non-deduced contexts, and p5.5 says:

A function parameter for which argument deduction cannot be done because the associated function argument is a function, or a set of overloaded functions (13.4), and one or more of the following apply:

and p5.5.3 says:

the set of functions supplied as an argument contains one or more function templates.

My interpretation is that you have a function parameter for which the function argument is a (pointer to) a function and that function is a function template.

Arguably, because this isn't an overload set, this might be something that could be allowed in the future, but I read the standard as not guaranteeing that this technique will work.