Ambiguity can refer to two related concepts: 'ambiguous calls' and 'ambiguous grammars'.
Questions tagged [ambiguity]
400 questions
87
votes
3 answers
How to set break point on one file of a project which has many files with same name?
I want to set a break point in gdb on file service.cpp on line 45 and I do:
gdb> break service.cpp:45
The problem is that there are many service.cpp files in my application and it is not picking the one I am interested in. How can I specify the…

WilliamKF
- 41,123
- 68
- 193
- 295
80
votes
7 answers
The variable 'MyException' is declared but never used
I need to clear this warning :
try
{
doSomething()
}
catch (AmbiguousMatchException MyException)
{
doSomethingElse()
}
The complier is telling me :
The variable 'MyException' is declared but never used
How can I fix this.

Wassim AZIRAR
- 10,823
- 38
- 121
- 174
67
votes
5 answers
Django model with 2 foreign keys from the same table
I wanted a Django model with 2 foreign keys from the same table. It's an event table which has 2 columns for employees: the 'actor' and the 'receiver'. But I get this error:
Error: One or more models did not validate: tasks.task:…

Josh
- 1,365
- 3
- 13
- 23
52
votes
3 answers
C# The call is ambiguous between the following methods or properties: 'System.Math.Round(double, int)' and 'System.Math.Round(decimal, int)
My code won't compile due to the error below:
The call is ambiguous between the following methods or properties: 'System.Math.Round(double, int)' and 'System.Math.Round(decimal, int)
My code is
Math.Round(new FileInfo(strFilePath).Length / 1024,…
James B
49
votes
4 answers
warning: refname 'xxx' is ambiguous when using git-svn
I am using git as a frontend to Subversion (via git svn).
So, for every svn trunk/branch I have remote branch in git named "remotes/xxx". For example "remotes/trunk", "remotes/coolfeature".
Now I want have one "default" local branch for every remote…

Ivan Dubrov
- 4,778
- 2
- 29
- 41
43
votes
4 answers
No warning or error (or runtime failure) when contravariance leads to ambiguity
First, remember that a .NET String is both IConvertible and ICloneable.
Now, consider the following quite simple code:
//contravariance "in"
interface ICanEat where T : class
{
void Eat(T food);
}
class HungryWolf : ICanEat,…

Jeppe Stig Nielsen
- 60,409
- 11
- 110
- 181
36
votes
9 answers
C# interface method ambiguity
Consider the following example:
interface IBase1
{
int Percentage { get; set; }
}
interface IBase2
{
int Percentage { get; set; }
}
interface IAllYourBase : IBase1, IBase2
{
}
class AllYourBase : IAllYourBase
{
int percentage;
int…

void.pointer
- 24,859
- 31
- 132
- 243
31
votes
3 answers
Why is it ambiguous to call overloaded ambig(long) and ambig(unsigned long) with an integer literal?
When compiling
void ambig( signed long) { }
void ambig(unsigned long) { }
int main(void) { ambig(-1); return 0; }
I get
error C2668: 'ambig' : ambiguous call to overloaded function
could be 'void ambig(unsigned long)'
or 'void…

user541686
- 205,094
- 128
- 528
- 886
26
votes
3 answers
What happens when a class and a function have the same name?
#include
using namespace std;
struct test
{
test(){cout<<"class"<

Denis
- 2,786
- 1
- 14
- 29
25
votes
2 answers
Ambiguous implicit values
I've been thinking I understand scala implicits until recently faced strange problem.
In my application I have several domain classes
case class Foo(baz: String)
case class Bar(baz: String)
And a class that is able to construct domain object from…

lambdas
- 3,990
- 2
- 29
- 54
20
votes
3 answers
Ambiguity with Action and Func parameter
How is it possible that this code
TaskManager.RunSynchronously(fileMananager.BackupItems, package);
causes a compile error
The call is ambiguous between the following methods or…

Ondrej Janacek
- 12,486
- 14
- 59
- 93
19
votes
2 answers
Compile time warning when using 'Microsoft.Office.Interop.Word._Document.Close'
Anyone know how to solve this warning message?
Ambiguity between method 'Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close'. Using method…

Su Beng Keong
- 1,034
- 1
- 13
- 30
19
votes
3 answers
Why does C# allow ambiguous function calls through optional arguments?
I came across this today, and I am surprised that I haven't noticed it before. Given a simple C# program similar to the following:
public class Program
{
public static void Main(string[] args)
{
Method(); // Called the method with no…

Adam Goodwin
- 3,951
- 5
- 28
- 33
19
votes
5 answers
Anonymous Namespace Ambiguity
Consider the following snippet:
void Foo() // 1
{
}
namespace
{
void Foo() // 2
{
}
}
int main()
{
Foo(); // Ambiguous.
::Foo(); // Calls the Foo in the global namespace (Foo #1).
// I'm trying to call the `Foo` that's defined in the…

sharp02
- 193
- 1
- 4
17
votes
2 answers
C++ method call and type scope resolution ambiguity
I hope the title actually describes what I wanted to ask...
I wrote a piece of code that compiles with gcc and works as I intended. However, it does not compile with llvm and the code executes differently when compiled with icc!
Here is an example…

Nowakus
- 571
- 4
- 7