ambiguous-call Questions

0

As I understand it, the outcome of a function name usage might be one of the following: There are no (best) viable functions — overload resolution fails. The suboutcomes are: There are no candida...

3

Solved

I have a basic question related to multiple inheritance in C++. If I have a code as shown below: struct base1 { void start() { cout << "Inside base1"; } }; struct base2 { void start() { c...
Castellated asked 27/7, 2011 at 14:10

8

Solved

Consider this Minimal, Reproducible Example : interface Code { static void main(String[] args) { symbol( String.valueOf( true ? 'a' : true ? 'b' : true ? 'c' : fail() ) ); } private stat...

5

Solved

I've ran into problem with extension method resolution. LINQ and MoreLINQ contain zip method, it was present in .NET since 4.0 version and was always in MoreLINQ library. But you can't use one of t...
Lovable asked 18/1, 2013 at 10:31

3

Solved

Hi I have a simple RestController in my Sample: @RestController public class PersonController { @RequestMapping(name = "/getName", method = GET) public String getName() { return "MyName"; } ...
Overpowering asked 9/3, 2015 at 12:38

2

Solved

I fixed a bug recently. In the following code, one of the overloaded function was const and the other one was not. The issue will be fixed by making both functions const. My question is why com...
Epoxy asked 18/7, 2019 at 20:0

2

Solved

Consider the following snippet (available on compiler epxlorer): template<typename T, typename... Args> auto foo(Args&&... args) {} template<typename... Args> auto foo(Args&am...
Eyetooth asked 8/7, 2019 at 23:14

7

Solved

Compiling the following code will return The call is ambiguous between the following methods or properties error. How to resolve it since I can't explicitly convert null to any of those classes? s...
Bloodfin asked 28/10, 2010 at 14:52

3

Solved

I'm learning about function overloading in C++ and came across this: void display(int a) { cout << "int" << endl; } void display(unsigned a) { cout << "unsigned" << endl...
Meshed asked 2/8, 2017 at 19:14

1

Solved

I'm trying to compile a library on microsoft C++ compiler 14.1 (Visual Studio 2017) but I'm getting a strange error due to an ambiguous call to a class method. After some testing I isolated the fol...
Trencher asked 12/7, 2017 at 12:7

2

Solved

I have an overloaded function in my code with the type signatures: void foo(std::string); void foo(std::vector<std::string>); I would like the user of foo to be able to call it with either...
Assurance asked 11/5, 2017 at 16:43

2

Solved

I'm doing some kind of wrapper that looks like this: #include <iostream> template<class T, class Value> void Apply(void (T::*cb)(Value), T* obj, Value v) { (obj->*cb)(v); } class...

3

Solved

Per this question, Java will select the "most specific" option when trying to select between ambiguous overloaded constructors. In this example: public class Test{ private Test(Map map){ System....
Pennypennyaliner asked 16/8, 2016 at 16:15

1

This is not about windows forms at all it's here only for the "background". I was toying around Windows Forms when I got an error on an AddRange for a MenuStrip.Items requiring to cast ToolStripMe...
Rickrickard asked 7/7, 2016 at 11:37

2

Solved

I just wrote some code with the following structure: public void method(int x) { //... } public void method(int x, String... things) { //... } I was rather surprised that this compiled,...
Collinsia asked 12/8, 2015 at 14:15

2

Solved

I am not familiar with templates. I've just started learning it. Why I am getting errors in following program? #include <iostream> #include <string> using std::cout; using std::string;...
Ascidian asked 15/5, 2015 at 17:4

3

Solved

I'm wondering why a call to a static function is ambiguous, even when one of the two is obviously impossible to call as it is private. I was hoping I could use private / protected inheritance to he...
Laborsaving asked 28/12, 2014 at 18:56

3

Solved

#include <iostream> using namespace std; struct test { test(){cout<<"class"<<endl;} }; void test(){cout<<"function"<<endl;} int main() { test(); return 0; } Out...
Sateen asked 13/10, 2014 at 14:6

6

Solved

The following code causes a compiler error, as it is ambiguous call but the problem if we use object instead of ArrayList no error happens and the string version works fine; Do you have an explanat...
Reece asked 19/5, 2010 at 12:25

4

Solved

I'm working on a C++ program for class, and my compiler is complaining about an "ambiguous" function call. I suspect that this is because there are several functions defined with different paramete...
Oler asked 26/9, 2011 at 1:34

1

#include <iostream> #include <cstdint> template<int T> void foo() { std::cout << "a" << std::endl; } template<uint8_t T> void foo() { std::cout << "b" ...
Mammillate asked 26/6, 2013 at 23:50

1

Solved

The following code compiles fine with gcc and clang. template <typename T> struct identity { typedef T type; }; template <typename T> void foo(typename identity<T>::type); tem...
Hyperthyroidism asked 26/5, 2013 at 22:29

2

Solved

I was surprised by the fact that GCC does not consider the call to foo() in the following program ambiguous: #include <iostream> struct B1 { bool foo(bool) { return true; } }; struct B2 { b...
Glidewell asked 26/2, 2013 at 1:46

2

Solved

I have to overload the shift operator " << " both for writing in console and to write on a binary file.. I am doing okay for the ostream overloading, while I am having some problem overloadi...
Beau asked 30/1, 2013 at 18:3

2

Solved

I have the following code, which shows a squiggly red line under the lambda expression after .Any( because of an "ambiguous invocation" between System.Linq versions 3.5 and 4.0 - how do I force it ...
Horsehide asked 15/2, 2012 at 17:1

© 2022 - 2024 — McMap. All rights reserved.