Consider following program: (See live demo here http://ideone.com/7VHdoU )
#include <iostream> void fun(int*)=delete; void fun(double)=delete; void fun(char)=delete; void fun(unsigned)=delete; void fun(float)=delete; void fun(long int); int main() { fun(3); } void fun(long int a) { std::cout<<a<<'\n'; } Compiler is giving following error:
error: call of overloaded 'fun(int)' is ambiguous fun(3); ^ But I don't understand why & how it is ambiguous? Does it involve any kind of automatic type promotion here? I know that calling fun with (3L) makes compilation successful.
int, and the compiler cannot choose whether to convert todouble,char,unsigned int,floatorlong int.deleted functions still participate in overload resolution.