#include <iostream>
template <typename T >
void f(T a,int b,int c=3);
template <typename T >
void f(T a,int b=9,int c);
int main()
{
f(3);
f(3,6);
f(3,6,9);
return 0;
}
template <typename T >
void f(T a,int b,int c)
{
std::cout<<a<<' '<<b<<' '<<c<<'\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp0ZW1wbGF0ZSA8dHlwZW5hbWUgVCA+CnZvaWQgZihUIGEsaW50IGIsaW50IGM9Myk7CnRlbXBsYXRlIDx0eXBlbmFtZSBUID4Kdm9pZCBmKFQgYSxpbnQgYj05LGludCBjKTsKaW50IG1haW4oKQp7CglmKDMpOwoJZigzLDYpOwoJZigzLDYsOSk7CglyZXR1cm4gMDsKfQp0ZW1wbGF0ZSA8dHlwZW5hbWUgVCA+CnZvaWQgZihUIGEsaW50IGIsaW50IGMpCnsKCXN0ZDo6Y291dDw8YTw8JyAnPDxiPDwnICc8PGM8PCdcbic7Cn0K
prog.cpp:5:6: error: default argument missing for parameter 3 of 'void f(T, int, int)'
void f(T a,int b=9,int c);
^
prog.cpp:5:25: error: redeclaration of 'template<class T> void f(T, int, int)' may not have default arguments [-fpermissive]
void f(T a,int b=9,int c);
^
prog.cpp: In function 'int main()':
prog.cpp:8:5: error: no matching function for call to 'f(int)'
f(3);
^
prog.cpp:3:6: note: candidate: template<class T> void f(T, int, int)
void f(T a,int b,int c=3);
^
prog.cpp:3:6: note: template argument deduction/substitution failed:
prog.cpp:8:5: note: candidate expects 3 arguments, 1 provided
f(3);
^