[Bug c++/102097] New: Error in selecting more specialized function in case of ambiguity

fchelnokov at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Aug 27 13:36:22 GMT 2021


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

            Bug ID: 102097
           Summary: Error in selecting more specialized function in case
                    of ambiguity
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

In this program
```
void fun(auto&){}
void fun(auto&&){}
int main() { void(*ptr)(int&) = &fun; }
```
GCC reports ambiguity of function selection. Clang reports the same error as
well. But the community of stack-overflow believes
(https://stackoverflow.com/questions/68949303/which-is-the-most-specialized-function-template-in-the-context-of-taking-the-add)
that it is not correct compiler behavior and a more specialized function
`fun(auto&)` must be selected.


More information about the Gcc-bugs mailing list