109 questions
2
votes
3
answers
202
views
Multiple namespaces overloaded operator<<, how can I use them?
I'm reading a book. Obviously there are some failures in it.
In the code below, how can I access plant::operator<< in run() and plant::debug::operator<< in diagnostic()? The compiler can't ...
0
votes
0
answers
124
views
Problem of ambiguity in WPF .NET 8 project when using WindowsForms globally
I'm working on a WPF .NET 8 project and the problem started when I wanted to show my application icon in the notification area menu. In WPF it seems that it can't be used directly, you need to enable ...
0
votes
0
answers
88
views
Overloading resolution - match through const conversion is considered exact match? [duplicate]
void f(int) {}
void f(const int&) {}
int main()
{
int i = 1;
f(i);
}
I get an ambiguous call here, what am I missing? I'm using GCC 11.2.0 with -std=c++11.
I'm reading C++ Primer 5th ...
0
votes
0
answers
68
views
Method with optional parameters validates fine in the Editor but (sometimes) fails during compilation
I have a problem when compiling this line of code:
var span = m_tracer.StartActiveSpan("FileTrace");
What's strange about this is, this exact same line of code compiles just fine in other ...
2
votes
0
answers
39
views
gcc-11 compiler problems with multiple inheritance and statement "using" [duplicate]
I am having problems with gcc-11 C++ compiler when using multiple inheritance
and I want to call a specific method of the base class and I write using A::m1 explicitely.
Visual C++ 2022 works with ...
0
votes
2
answers
140
views
implicit operator causing ambiguous method signature resolution
I have the following two methods that both create me a couple of Constraint<T> instances. The first creates types of Constraint<Quantity> and the second creates types of Constraint<...
1
vote
1
answer
311
views
Ambigous extension method GetValueOrDefault when porting from .NET Framework to .NET
While porting my (large) application from .NET Framework 4.X to .NET 5+, stumbled over the new System.Collections.Generic.CollectionExtensions, which did not exist in the .NET Framework. Before it ...
0
votes
1
answer
178
views
overloading functions to use with both variables and literals - ambiguous call error
I'm trying to overload some functions to work with several data types. This is trivial when I'm passing variables as parameters, thusly:
void fnc(int32_t d){
Serial.println((String) "int32 = &...
0
votes
0
answers
58
views
How to restrict overloaded function applicability so that it only applies to certain types in order to avoid ambiguous call errors
I have a class that I use to apply functions to each element in a vector representing an image.
template <typename T, typename E>
class func1_img_expr_t : public img_expr_t<T> {
public:
...
6
votes
0
answers
95
views
How to check whether, given the argument types, an implicit use of `operator ()` would result in exactly one best viable candidate?
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 candidates....
1
vote
1
answer
258
views
CS0121 Ambiguous overloaded function call with char, int, double parameters implicitly converted to user-defined types in C#
I've got some C# classes, MyChar, Myint, MyDouble, that wrap char, int and double. Each has an implicit conversion operator from the wrapped type to the user-defined one. I've also got a set of ...
21
votes
8
answers
3k
views
"redundant cast to java.lang.Object" warning for necessary cast
Consider this Minimal, Reproducible Example :
interface Code {
static void main(String[] args) {
symbol(
String.valueOf(
true ? 'a' :
true ? 'b' ...
2
votes
1
answer
248
views
Combine capabilities of classes (mixins) with ambiguous calls
I was reading about the "mixin" technique in C++ but there is something I don't understand and seems to be a limitation in the language that prevents to do it generically because of ...
1
vote
1
answer
2k
views
Error reference to 'distance' is ambiguous [duplicate]
I cannot figure out why I am getting the error "reference to 'distance' is ambiguous".
I have passed class object as an argument in friend function.
#include <iostream>
using namespace ...
2
votes
1
answer
650
views
Ambiguous call for UseHttps extension method
In my ASP.NET Core 3.1 project I have the following configuration in Program.cs:
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions....