felixhao28 / JSCPP

A simple C++ interpreter written in JavaScript

Home Page:https://felixhao28.github.io/JSCPP/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ambiguous method invoking, 2 compatible methods

billcollis opened this issue · comments

In the following code a function prototype is used and an error is thrown

`#include
using namespace std;

int func(int x);

int main() {
int a;
cin >> a;
a = func(5); //fails
//a = func(a); //works
cout << a << endl;
return 0;
}

int func(int x){
x*= 10 ;
return x;
}`

it appears that the number '5' is of type 'unsigned int' so when getCompatibleFunction sees two possible functions (the prototype and the actual function) it throws the error.

Thanks for reporting! I just pushed the fix.