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

Why doesn't the C# compiler get confused about methods that have default arguments?

Why doesn't the C# compiler get confused about methods that have default arguments? In the below code SayHello() may refer to: SayHello() SayHello(string arg1 = null) SayHello(string arg1 = null, string arg2 = null) SayHello(string arg1 = null,…
Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137
3
votes
6 answers

Java ambiguous type for method?

EDIT: This turned out not be a problem with the code at all, but with a bug in the Groovy Eclipse plugin (http://jira.codehaus.org/browse/GRECLIPSE-373) Eclipse is giving me a weird error message about ambiguous types in a Java program and I really…
Jeff Storey
  • 56,312
  • 72
  • 233
  • 406
3
votes
2 answers

T-SQL statement with SubSelect and Join - Ambiguous column name error

I've spent hours researching answers to what should be a very simple T-SQL statement. Here is the situation. I'm tyring to report over a help desk data base. I have one table (calllog) that contains basic non-repeating information about a trouble…
2
votes
1 answer

XNA Vector2 ambiguous issue with Farseer library

So I searched and couldn't find anyone else having this problem: When I try to use a Vector2 anywhere in my code, the following error is spit out at me: Ambiguous reference: Microsoft.Xna.Framework.Vector2 Microsoft.Xna.Framework.Vector2 match Yes,…
2
votes
1 answer

Python - very ambiguous error message

I'm working on a large scale software system written in Python right now, which includes multiple modules. I was wondering what I should do about this, if anyone could make any sense of this error message that I keep receiving: File "",…
Jacob Griffin
  • 4,807
  • 3
  • 16
  • 11
2
votes
1 answer

Ambiguous call with Eigen types

Attempting to make a class that takes both a Eigen::Matrix3d and Eigen::Vector4d as constructor args and have run into an issue with ambiguity. Given the following test class, class MyClass { public: MyClass(const Eigen::Matrix3d& m) { …
jlack
  • 305
  • 2
  • 13
2
votes
1 answer

How to prepend '-' character to elements in a pandas column containing particular characters? Getting `ValueError`

I have a Dataframe from a csv containing 'TransactionAmounts' from customers. The system that exported the reported appends a 'CR' to certain rows, as such: TransacAmt Column I would like to add a negative sign infront of the values that do have a…
2
votes
1 answer

Resolve ambiguity in assignment constructor c++

Description I have code that is ambiguous when a certain constructor is present. But, when I comment said constructor out, then the compiler complains that a necessary constructor is missing. Minimum Working Example struct X; struct E{ E(const…
kaisong
  • 65
  • 6
2
votes
1 answer

Why are `function` and `function` parameter types sometimes ambiguous for overloading?

Following up my question c++ - How do implicit conversions work when using an intermediate type?, from which I understood the rule of 1 implicit conversion max, I'm trying to understand a more advanced use case involving function arguments. Let's…
2
votes
1 answer

pyspark.sql.utils.AnalysisException: Column ambiguous but no duplicate column names

I'm getting an ambiguous column exception when joining on the id column of a dataframe, but there are no duplicate columns in the dataframe. What could be causing this error to be thrown? Join operation, where a and input have been processed by…
2
votes
1 answer

Ambiguous type in a simple statement Haskell

I want simply add 3.5 + floor 3.5 but this error occur: Ambiguous type variable 't' in constraints: 'Fractional t' arising from the literal '3.5'... 'Integral t' arising from a use of floor... How to fix this…
2
votes
1 answer

ambiguity of overloaded function taking constant Eigen argument

I've designed a class with two overloaded functions taking Eigen data structures of different sizes. The code compiles as long as I'm passing lvalues but if I pass an rvalue I get a compiler error ambiguity because both return the same…
mcamurri
  • 153
  • 11
2
votes
1 answer

Mocking overloaded methods with the same number of input arguments using GMock

I have a class that defines an overloaded method that I need to mock. The issue is, the two overloads both take only one argument and GMock seems to think the call is ambiguous. Here is a small example demonstrating the problem (oversimplified for…
tjwrona1992
  • 8,614
  • 8
  • 35
  • 98
2
votes
1 answer

Why does the compiler say that the call is ambiguous in associated types while it isn't?

This code: trait SayHello { fn say_hello() { println!("hello") } } trait Foo { type Hello: SayHello; } trait Bar: Foo { type Hello: SayHello; } struct Generic(T); impl Generic where T: Bar::Hello> { fn…
Boiethios
  • 38,438
  • 19
  • 134
  • 183
2
votes
1 answer

Problem with Ambiguous interfaces with gfortan

I have a situation similar to the following code snipped (saved in test.f90): module interfaces_mod private public :: interf interface interf module procedure interf1 module procedure interf2 end interface …
ntausend
  • 43
  • 2