https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884

            Bug ID: 113884
           Summary: GCC rejects valid program saying ambiguous call when
                    using std::vector
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following valid program is rejected by gcc
```
#include <type_traits>
#include <vector>

struct A {
    A();
};


void func(std::vector<double> values);
void func(std::vector<A> as);

int main() {
    func({ 4.2 }); //gcc rejects this
}
```

One way to see that gcc is incorrect here is by just removing the first
overload and then gcc also starts rejecting this, implying the the second
overload is not even viable so how can it make the call ambiguous.

```
#include <type_traits>
#include <vector>

struct A {
    A();
};


void func(std::vector<A> as);

int main() {
    func({ 4.2 });//now gcc also starts correctly rejecting this implying that
this is not even viable so how can it possibly make the call ambiguous 
}
```

Reply via email to