This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Binding a const reference to a function
- To: EGCS <egcs-bugs at egcs dot cygnus dot com>
- Subject: Binding a const reference to a function
- From: Valentin Bonnard <Bonnard dot V at wanadoo dot fr>
- Date: Sun, 04 Jul 1999 10:34:56 +0200
I thought that moving some simple code from one egcs to
another would be trivial, but actually I had one problem:
quatramaran bonnard ~/C++ $ eg++ func-as-deduced-param.cc
func-as-deduced-param.cc: In function `void foo()':
func-as-deduced-param.cc:6: no matching function for call to `bar (void
(&)())'
quatramaran bonnard ~/C++ $ g++ func-as-deduced-param.cc
func-as-deduced-param.cc: In function `void foo()':
func-as-deduced-param.cc:6: converting to `void ()()' from `void (*)()'
func-as-deduced-param.cc:3: in passing argument 1 of `bar<void
()()>(void ( &)())'
quatramaran bonnard ~/C++ $ eg++ -v
Reading specs from
/opt/egcs-27-May-99/lib/gcc-lib/i686-pc-linux-gnu/gcc-2.96/specs
gcc version gcc-2.96 19990527 (experimental)
quatramaran bonnard ~/C++ $ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
quatramaran bonnard ~/C++ $ cat func-as-deduced-param.cc
void p ();
template <typename P>
void bar (const P&);
void foo ()
{
bar(p);
}
IMO the compiler shouldn't convert p to a void (*) () but it should
deduce that P = void ().
--
Valentin Bonnard