[Bug c++/85498] New: Unable to resolve function name with inferred return type

gcc at dcousens dot com gcc-bugzilla@gcc.gnu.org
Mon Apr 23 06:29:00 GMT 2018


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

            Bug ID: 85498
           Summary: Unable to resolve function name with inferred return
                    type
           Product: gcc
           Version: 7.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at dcousens dot com
  Target Milestone: ---

gcc version 7.3.1 20180312 (GCC)

But,  this fails on many different GCC versions.
https://godbolt.org/g/G5gEx2

**Expected:** Compilation should succeed (like other compilers, MSVC, Clang,
etc)

**Actual:** Compilation failed

```
template<typename T>
auto foo (T t) {
    return t;
}

template<typename T>
void bar (const T) {}

int main () {
    bar(foo<int>);
}
```

Result:
```
<source>: In function 'int main()':

<source>:10:17: error: no matching function for call to 'bar(<unresolved
overloaded function type>)'

     bar(foo<int>);

                 ^

<source>:7:6: note: candidate: template<class T> void bar(T)

 void bar (const T) {}

      ^~~

<source>:7:6: note:   template argument deduction/substitution failed:

<source>:10:17: note:   couldn't deduce template parameter 'T'

     bar(foo<int>);

                 ^

Compiler returned: 1
```


More information about the Gcc-bugs mailing list