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
5
votes
2 answers

Ambiguous class inheritance

#include #include using namespace std; class Tcirculo{ float radio; float diametro; float area; public: void carea(float r){radio= r; area=(M_PI*((r*r)));} float cdiam(float r) {diametro =…
5
votes
1 answer

Two plugins linking to identically named DLLs or shared library object (so) with different implementation (code)

I have two "plugins" (think of them just as two different applications in a software package for discussion sake) that dynamically link to two separately built versions of my library. My code is written in C++ and uses consistent namespaces…
squashed.bugaboo
  • 1,338
  • 2
  • 20
  • 36
4
votes
2 answers

C# Dynamic Function AmbigiousMatchException?

I'm getting an AmbigiousMatchException for a function calling Type.GetMethod() even though everything looks pretty much correct. public partial class IBaseEvent { private Dictionary> funcs = new…
Matt Lima
  • 307
  • 2
  • 6
4
votes
1 answer

SQLAlchemy and Ambiguous Column name

Ive had a good search on google but I cant seem to find an answer to this error in my case. Im not making any joins, Im literally just trying to get all from this table. All of the other queries work fine, but this seems to be messing up with this…
RonnyKnoxville
  • 6,166
  • 10
  • 46
  • 75
4
votes
2 answers

QObject inheritance Ambiguous Base

I have a simple class that stops and starts a timer when my program gains and loses focus but it gives the error tha QObject is Ambiguous base of MyApp on every signal-slot connection. Here is the relevant code: class MyApp : public QApplication,…
Gerharddc
  • 3,921
  • 8
  • 45
  • 83
4
votes
2 answers

what cause the ambiguous overload in gcc?

#include #include template struct Wrapper { T value; operator T&() & { std::cout << "call const ref" << std::endl; return this->value; } operator const T&() const& { std::cout << "call const ref" <<…
Yanyu Peng
  • 123
  • 3
4
votes
1 answer

Ambiguous Overloaded Operator C++20

I'm trying to test my project in the latest Visual Studio and Clang versions. One of the errors that pops up is related to an ambiguous operator (with reversed parameter order). This does not seem to pop up in C++17. For example:…
wakey
  • 2,283
  • 4
  • 31
  • 58
4
votes
1 answer

How to getting around pywinauto's ElementAmbiguousError: There are 2 elements that match the criteria error

I am trying to automate running Rufus using python and pywinauto. So far I have been able to run the executable and modify the controls on Rufus' main screen. After the code I have written clicks the "START" button, Rufus displays a popup. This…
Cyberclops
  • 311
  • 2
  • 17
4
votes
4 answers

C++ Ambiguous access - virtual inheritance

I tried to call the default constructor of the virtual base class X from its most-derived class V. I do not know why calling X's constructor from V is considered an ambiguous access. Can anyone help? The code is below: #include using…
4
votes
1 answer

Why is this implicit ambiguity behaviour happening?

I have a typeclass Search, which has an instance Search[A] if we have a TypeClass1[A] or a TypeClass2[A] instance. With preference given to the 1 instance. The following compiles: trait TypeClass1[A] trait TypeClass2[A] trait Search[A] object…
Gesar
  • 389
  • 1
  • 7
4
votes
0 answers

Ambigous Method Call even though it's unambigous

I have Oracle-Java version 1.8.0_171 My Code: public void test() { run(x -> "1"); // calls run(Function) run(x -> System.out.println("test")); // fails to compile run(() -> System.out.println("test")); // calls…
Johnneh
  • 247
  • 1
  • 10
4
votes
1 answer

Managing multiple instances of HttpClient using Dependency Injection

I'm creating an instance of HttpClient for each distinct API that my web application is communicating to. I want to use Dependency Injection with SimpleInjector to inject HttpClient to the business classes. For example, I have ITwitterBusiness and…
4
votes
1 answer

Ambiguous use of '!=' operator

So, I'm trying to gat CGPoint, CGVector, and CGSize to work nicely for me when using SpriteKit. All of them are just structs with a vertical and horizontal component (vectors). So I made a protocol: VectorType protocol VectorType { init(x:…
lsauceda
  • 315
  • 3
  • 12
4
votes
1 answer

How this function call is ambiguous in C++?

Consider following program: (See live demo here http://ideone.com/7VHdoU ) #include 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…
Destructor
  • 14,123
  • 11
  • 61
  • 126
4
votes
2 answers

ambiguous operator[] in variadic template

I'm trying to compile this example, where a variadic class template inherits from a variadic amount of bases, each of which implements a different operator[]: #include template struct Field { typename T::value_type…