Questions tagged [ambiguous]

An ambiguous call is a situation in which the compiler cannot deduce which version of a function or method to use from the given parameter types. This tag should not be confused with the [ambiguity] tag.

An ambiguous call occurs when the parameters can be converted in many ways such that they fit 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.

612 questions
3
votes
3 answers

Ambiguous template binary operators?

Consider the following code namespace std { struct type1 {/* Definition */}; template constexpr T operator+(const type1& x1, const T& x); template constexpr T operator+(const T& x, const type1& x1); } namespace other…
Vincent
  • 57,703
  • 61
  • 205
  • 388
3
votes
1 answer

C# Compiler complaining function is ambiguous with itself

Working in a C# WebApp project which I've inherited. I have a couple function definitions as so... public static DataTable ExecuteDT(this AppDBContext target, string sql, int timeoutSeconds = defaultTimeoutSeconds) { DbCommand cmd =…
eidylon
  • 7,068
  • 20
  • 75
  • 118
3
votes
1 answer

Call to variadic template is ambigous

I have a variadic template function that works except if I call it with an argument of the same type as T. template std::shared_ptr make_shared(Arg&&... arg) { return std::shared_ptr(new…
rozina
  • 4,120
  • 27
  • 49
3
votes
0 answers

How to properly resolve ambiguous invocation exceptions on extension methods

I just received the following compile time error in C#: Ambiguous invocation:       string GetDescription(this LibA.enum_contact) in LibA       string GetDescription(this LibB.enum_contact) in LibB It is clear what it means, but since I need…
Abel
  • 56,041
  • 24
  • 146
  • 247
3
votes
2 answers

Resolving type ambiguities using available class instances

Given the following code: import Data.Word data T = T deriving (Eq, Show) class C a where f :: a -> () instance C T where f _ = () instance C Word16 where f _ = () main = return $ f 0x16 GHC complains that it can't infer what the…
danielpwright
  • 657
  • 5
  • 10
3
votes
1 answer

Query error with 2 ambiguous column names in SQL

I've been working with this Query for bit now and I'm having a hard time. I'm new to SQL and I can't figure our why I'm getting the error: SELECT customer_number, first_name_initial, last_name,serve_address_1, serve_address_2, serve_city,…
E. Peterson
  • 432
  • 2
  • 6
  • 15
3
votes
1 answer

Two views are vertically ambiguous ,Xcode warning message dealing with contraints

The warning message i get is that 2 views are vertically ambiguous( looks fine when i run it btw) The two views that its talking about is the two score labels. My first question is what does the warning mean and how would i be able to solve…
user2854773
3
votes
1 answer

Trying to remove ambiguous call in constructor involving int and long

"The call is ambiguous between the following methods or properties: 'fInt.fInt(int, bool)' and 'fInt.fInt(long, bool)'" Here are my two constructors: public fInt(int i, bool scale = true) { if (scale) value = i * SCALE; else value =…
ATD
  • 824
  • 1
  • 9
  • 14
3
votes
3 answers

C++ typedef inheritance ambiguous problem

I wish to use a helper class which would only make few Qt typedef aliases for the given template argument. Ofc ambiguous comes a cross very quickly and also quite often with my current design situation on the project, since one wish to access Base…
krizajb
  • 1,715
  • 3
  • 30
  • 43
3
votes
1 answer

Global unnamed namespace ambiguity vs nested unnamed namespace ambiguity

Consider the following two code snippets: Snippet A #include namespace { bool foo = false; } bool foo = true; int main() { std::cout << foo << std::endl; } Snippet B #include namespace A { namespace { …
OMGtechy
  • 7,935
  • 8
  • 48
  • 83
3
votes
1 answer

implicit conversion sequence in function overloading

I don't understand how the compiler chooses the best candidates. For example, let's have the following code: int function(double, int, int){...} int function(int, double, double){...} If the second function needs to convert two variables and the…
greg phillip
  • 151
  • 1
  • 7
3
votes
1 answer

boost::program_options overloaded validate is ambiguous

I am trying to parse a list input from the command line. My class is derived from vector The compiler complains about a overloaded validate being ambiguous. I can see why, but do not know how to solve this issue. Please help. Below is a minimal…
3
votes
1 answer

WCF with multiple services and namespace issues

I have created a number of WCF Services, for arguments sake they are called Service1 and Service2. Both of the services return (at some point, possibly through a relationship inside an object) a Customer object. For testing sake, I have added a…
Jamie Chapman
  • 4,229
  • 5
  • 29
  • 47
3
votes
2 answers

Specifying for ambiguous reference

In mdart/mdart_function.h, function hash is defined. inline nsaddr_t hash(nsaddr_t id) { bitset tempAddress_ (id); bitset address_; for(unsigned int i=0; i
user2211319
3
votes
1 answer

Sqlite, join table: ambiguous column error

I have a database and I am executing a query: select * from Exams LEFT OUTER JOIN Test on Test.tExamID = Exams.eID LEFT OUTER JOIN Test on Users.userID = Test.tUserID But I got an error ambiguous column name main.Test.tID.…
Lạng Hoàng
  • 1,790
  • 3
  • 17
  • 32