This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Binding a const reference to a function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]