#include <iostream>
#include <string>
template <typename T>
void print(const std::basic_string<T>& a, const std::basic_string<T>& b)
{
std::cout << a << b << std::endl;
}
int main()
{
std::string bar = "bar";
print("foo", bar);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnZvaWQgcHJpbnQoY29uc3Qgc3RkOjpiYXNpY19zdHJpbmc8VD4mIGEsIGNvbnN0IHN0ZDo6YmFzaWNfc3RyaW5nPFQ+JiBiKQp7CiAgICBzdGQ6OmNvdXQgPDwgYSA8PCBiIDw8IHN0ZDo6ZW5kbDsKfQoKaW50IG1haW4oKQp7CiAgICBzdGQ6OnN0cmluZyBiYXIgPSAiYmFyIjsKICAgIHByaW50KCJmb28iLCBiYXIpOwp9
prog.cpp: In function ‘int main()’:
prog.cpp:13:21: error: no matching function for call to ‘print(const char [4], std::string&)’
print("foo", bar);
^
prog.cpp:13:21: note: candidate is:
prog.cpp:5:6: note: template<class T> void print(const std::basic_string<_CharT>&, const std::basic_string<_CharT>&)
void print(const std::basic_string<T>& a, const std::basic_string<T>& b)
^
prog.cpp:5:6: note: template argument deduction/substitution failed:
prog.cpp:13:21: note: mismatched types ‘const std::basic_string<_CharT>’ and ‘const char [4]’
print("foo", bar);
^