https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60095
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #3)
> (In reply to lucdanton from comment #0)
> > Using ‘gcc version 4.9.0 20140123 (experimental) (GCC)’ with the following
> > snippet:
> >
> > //--------
> >
> > struct foo {
> > typedef void(*ptr)(int&);
> > operator ptr() const;
> > };
> >
> > int main()
> > {
> > foo f;
> > void* p = 0;
> > f(p);
> > }
> >
> > //--------
> >
> > $ g++-trunk -std=c++03 main.cpp
> > main.cpp: In function 'int main()':
> > main.cpp:10:8: error: no match for call to '(foo) (void*&)'
> > f(p);
> > ^
> > main.cpp:1:8: note: candidate is:
> > struct foo {
> > ^
> > main.cpp:10:8: note: foo::ptr {aka void (*)(int&)} <conversion>
> > f(p);
> > ^
> > main.cpp:10:8: note: candidate expects 2 arguments, 2 provided
> >
> > Same output for all -std=c++{03,11,1y} modes. If e.g. foo has a call
> > operator instead, then the appropriate ‘no known conversion for argument 1
> > from 'void*' to 'int&'’ is produced.
>
> Message is now:
>
> $ /usr/local/bin/g++ -c -std=c++03 -Wall -Wextra -pedantic 60095.cc
> 60095.cc: In function ‘int main()’:
> 60095.cc:10:8: error: no match for call to ‘(foo) (void*&)’
> f(p);
> ^
> 60095.cc:10:8: note: candidate: ‘foo::ptr {aka void (*)(int&)}’ <conversion>
> 60095.cc:10:8: note: conversion of argument 2 would be ill-formed:
> 60095.cc:10:8: error: invalid conversion from ‘void*’ to ‘int’ [-fpermissive]
> 60095.cc:10:8: error: cannot bind rvalue ‘(int)p’ to ‘int&’
> $
>
> Is that better enough for you? I think it's still kinda confusing, but at
> least there's no longer the bogus "expects 2 arguments, 2 provided" note
> anymore.
No reply so I guess it's better enough.