public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102097] New: Error in selecting more specialized function in case of ambiguity
@ 2021-08-27 13:36 fchelnokov at gmail dot com
2021-08-27 22:51 ` [Bug c++/102097] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: fchelnokov at gmail dot com @ 2021-08-27 13:36 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/102097] Error in selecting more specialized function in case of ambiguity
2021-08-27 13:36 [Bug c++/102097] New: Error in selecting more specialized function in case of ambiguity fchelnokov at gmail dot com
@ 2021-08-27 22:51 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27 22:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102097
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-08-27
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a C++11 version of the same problem:
template<class T>
void fun(T&){}
template<class T>
void fun(T&&){}
int main() { void(*ptr)(int&) = &fun; }
ICC accepts this one.
MSVC accepts both the original and this C++ version.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-27 22:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 13:36 [Bug c++/102097] New: Error in selecting more specialized function in case of ambiguity fchelnokov at gmail dot com
2021-08-27 22:51 ` [Bug c++/102097] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).