Why does overload of template and non-template function with the “same signature” call the non-template function?

Because the second overload is not a template.

When a template function and a non-template function are both viable for resolving a function call, the non-template function is selected.

From Paragraph 13.3.3/1 of the C++ 11 Standard:

[…] Given these definitions, a viable function F1 is defined to be a better function than another viable function F2 if for all arguments i, ICSi(F1) is not a worse conversion sequence than ICSi(F2), and then […] F1 is a non-template function and F2 is a function template specialization […]

Leave a Comment