Questions tagged [ambiguous-call]

Ambiguous call is a situation, when compiler cannot deduce from the passed parameter types, which version of function or method shall it use.

Ambiguous call happens, when the parameters can be converted in many ways, such that they fit to more than one overload of a function. For example:

void f(float f)
{

}

void f(double d)
{

}

Passing an int value to this function will cause an ambiguous call compiler error, because int can be converted both to float and to double while the compiler is not able to choose the overloaded version of function uniquely.

102 questions
0
votes
2 answers

Why am I getting an "Ambiguous Match" error here?

The page that I'm currently working on searches for various entities based on what portfolio they are in. In order to apply the other search criteria (besides for Portfolio) the page first gets the entities by portfolio and then applies the criteria…
Corey Adler
  • 15,897
  • 18
  • 66
  • 80
0
votes
1 answer

How to eliminate cast for constructor selection

I've been playing around with a generic mechanism for converting a value from one set of values to another, based on Boost's map_list_of template. The two sets could ultimately be disjoint, so it's not just conversion from one enumerated type to…
plong
  • 1,723
  • 3
  • 14
  • 14
0
votes
1 answer

Why G++ cannot resolve the scope of this apparently easy ambiguity when attempting to polymorphysm with CRTP?

I am attempting to create template classes where each can solve a specific facet of the problem so to be able to mishmash them without resorting to creating the traditional abstract virtual classes. For that, I believe CRTP would be the best…
user4705621
0
votes
2 answers

C# overloading ambiguity

class Program { public void x(int a, float b , float c) { Console.WriteLine("Method 1 "); } public void x(float a, int b,int c) { Console.WriteLine("Method 2 "); } static void Main(string[] args) { …
fz8975
  • 45
  • 1
  • 8
0
votes
1 answer

Function Ambiguation

I cannot understand how these two functions produce ambiguation. If the types are changed to integer or real, the compiler does not flag any ambiguation. Function split_to_str_unidim & ( & a, delim, mold, …
Zeus
  • 1,485
  • 1
  • 17
  • 33
0
votes
4 answers

How come this does not throw some kind of error regarding ambiguous methods?

I was messing around to see what I could and could not do with regards to generics. I have this situation and as far as I'm concerned the compiler should throw an error with regards to ambiguous method calls but it compiles perfectly fine. Why is…
Aelphaeis
  • 2,593
  • 3
  • 24
  • 42
0
votes
1 answer

C++ Inheritance Error : ambiguous error

In the next code, I get ambiguous error when calling D::f in _tmain(..) since B::f overrides A::f, the pointer to f in A::vtable points to B::f. 1) Why the compiler then gives ambiguous error? could someone please clear that? 2) I tried to overload…
Hesham Yassin
  • 4,341
  • 2
  • 21
  • 23
0
votes
1 answer

Eclipse Indigo running on Java 7 does not show ambiguous references to methods

I have an application that used to run on Java 1.5. It compiled and ran well. Recently, I've decided to migrate to Java 1.7. When I compile the code with Maven (I updated the Java version in the pom.xml), it displays several compilation errors,…
Khoa Nghiem
  • 315
  • 1
  • 18
0
votes
1 answer

Ambiguous reference to overloaded definition with inherited inner class, scala

So here is the problematic code: trait World { type State def dynamics(s: State): State // ... } trait GridWorld extends World { class State {...} // concrete def dynamics(s: State) = s // concrete // some other staff still…
Kane
  • 1,314
  • 2
  • 9
  • 14
0
votes
2 answers

Call ambiguous between methods that return different types when the return type is explicit

Possible Duplicate: Question about ambiguous calls in C# I have these two methods: TypeA MyMethod(string s) {} TypeB MyMethod(string s) {} The following call gives me "ambiguity between methods" error: TypeA ta = MyMethod("some string"); How…
user1306322
  • 8,561
  • 18
  • 61
  • 122
-1
votes
2 answers

Ambiguous method compilation error

I have the following code involving three classes A,B,C File A.pp does not compile with error 'ambigous call' on the call to inheriTed method doWhat() Which is the cause of the problem? How do I avoid it? A.h #include "B.h class A: public B, C{ …
-2
votes
1 answer

ambiguous call to overloaded constructor c++

I have this class class Field { public: Field(); ~Field(); Field(const std::string& nameP, const int idP , const std::map sequence=std::map(), const…
Joy
  • 1,707
  • 7
  • 29
  • 44
1 2 3 4 5 6
7