Questions tagged [ambiguity]

Ambiguity can refer to two related concepts: 'ambiguous calls' and 'ambiguous grammars'.

400 questions
5
votes
1 answer

Why is a malformed function used instead of an implicit conversion?

This is my Snippet: class Base{}; class Derived : private Base{}; template class Wrapper { public: template Wrapper( T2&& ) { } }; // Function declarations void func( Base& param ); void func(…
Jakob Riedle
  • 1,969
  • 1
  • 18
  • 21
5
votes
1 answer

Are these Python programs for detecting the ambiguity of a finite grammar correct?

I've been doing Udacity CS262 and for the Detecting Ambiguity problem I'm not sure if my solution is correct and I'm not sure if the "official" solution is correct either. Brief description of the problem: Write a function isambig(grammar, start,…
user2108462
  • 855
  • 7
  • 23
5
votes
1 answer

Problems with an ambiguous grammar and PEG.js (no examples found)

I want to parse a file with lines of the following content: simple word abbr -8. (012) word, simple phrase, one another phrase - (simply dummy text of the printing; Lorem Ipsum : "Lorem" - has been the industry's standard dummy text, ever since the…
static
  • 8,126
  • 15
  • 63
  • 89
5
votes
2 answers

Ambiguity error while overloading var args method and wrapper methods in java

I tried to compile following code but got error static void test(long... x) { System.out.println("long..."); } static void test(Integer... x) { System.out.println("Integer..."); } public static void main(String [] args) { int no=5; …
sar
  • 1,277
  • 3
  • 21
  • 48
5
votes
2 answers

Understanding a case of Haskell Type-Ambiguity

I wrote a Haskell program and got a compile error I don't understand. The program should: Get the command line arguments Concatenate tokenized arguments back to a single String Read the String into a NestedList data type Flatten the NestedList into…
recursion.ninja
  • 5,377
  • 7
  • 46
  • 78
5
votes
2 answers

Forward declaring a function that uses enable_if : ambiguous call

I have some trouble forward declaring a function that uses boost::enable_if: the following piece of code gives me a compiler error: // Declaration template void foo(T t); // Definition template typename…
Luc Touraille
  • 79,925
  • 15
  • 92
  • 137
5
votes
2 answers

Why does vb.net reject assignment to nested covariant interface as "ambiguous"

In the code: Interface ISelf(Of Out TMe) End Interface Class SomeBase Implements ISelf(Of SomeBase) End Class Class SomeDerived Inherits SomeBase Implements ISelf(Of SomeDerived) End Class Module ISelfTester Sub TestISelf() …
supercat
  • 77,689
  • 9
  • 166
  • 211
5
votes
2 answers

Why ambiguities with generics are inconsistent, instead of raising errors?

Possible Duplicate: Generic methods and method overloading Say I have a class like class SortedList { public string this[int i] { get { return "a"; /* dummy sample code */ } } public string this[K key] { get { return "b"; /* dummy…
user541686
  • 205,094
  • 128
  • 528
  • 886
4
votes
1 answer

Left factorisation in Parsing Expression Grammar

I’m trying to write a grammar for a language which allows the following expressions: Function calls of the form f args (note: no parentheses!) Addition (and more complex expressions but that’s not the point here) of the form a + b For example: f…
Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
4
votes
2 answers

haskell -- odd ambiguous type variable error message for code in "where" statement with TypeFamilies extension

Does anyone know why this code fails? {-# LANGUAGE NoMonomorphismRestriction, TypeFamilies #-} module Test where asExprTyp :: Expr γ => γ α -> α -> γ α asExprTyp x _ = x int = undefined :: Integer class Expr γ where …
gatoatigrado
  • 16,580
  • 18
  • 81
  • 143
4
votes
2 answers

Resolving ambiguity

I have a controller with 3 overloads for a create method: public ActionResult Create() {} public ActionResult Create(string Skill, int ProductId) {} public ActionResult Create(Skill Skill, Component Comp) {} in one of my views I want to create this…
ekkis
  • 9,804
  • 13
  • 55
  • 105
4
votes
1 answer

Class member access using qualified-id in case of ambiguity

Consider a struct B derived from two structs A<1> and A<2>, each defining a typename D to itself, and there is also a global typename D. Then one writes .D:: after a B object , which D must be taken? template struct A{ int v = N; using D = A;…
Fedor
  • 17,146
  • 13
  • 40
  • 131
4
votes
1 answer

call to function is ambiguous, but why?

#include using namespace std; void x(int a,int b){ cout<<"int int"<
Robert Page
  • 366
  • 4
  • 10
4
votes
1 answer

LINQ to SQL: How to handle ambiguous column names when joining tables?

I'm going to bootstrap this question with a previous one I asked: LINQ to SQL: Multiple joins ON multiple Columns. Is this possible? So I have a LINQ query: var query = from t1 in myTABLE1List // List join t2 in myTABLE1List …
aarona
  • 35,986
  • 41
  • 138
  • 186
4
votes
1 answer

Promotion of parameters during overloading

I was studying about overloading and I am completely getting confused with promotions. I looked at few articles in SO (implicit conversion sequence in function overloading) and I am sure some more are available, but could not find the right article.…
Rajesh
  • 1,085
  • 1
  • 12
  • 25