Re: Problems with GCC 4.3 C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
when you want to send realf pointer ro the ff function, you must specify that the input function of ff has two arguments, and when you want to call that function from ff, again you must specify both input, I see nothing strange here, fixed code is attached.

Best,
adrin.

2008/2/6 Horst H. von Brand <vonbrand@xxxxxxxxxxxx>:
A game (Linley's Dungeon Crawl's Stone Soup development line
<http://crawl-ref.sourceforge.net>, if you must know) did compile and work
with the GCC 4.1 series, but now it won't build. The construction it
complains about (after fixing what
<http://gcc.gnu.org/gcc-4.3/porting_to.html> suggests) is something like:



Note that the f() function can be called with one argument, and that is
what the template use tries to do; g++ complains:

 $ g++ -O2 -c tst.cc
 tst.cc: In function 'void ff(int, T) [with T = void (*)(int, int)]':
 tst.cc:13:   instantiated from here
 tst.cc:4: error: too few arguments to function

I'm no C++ expert at all, so both the "how it used to work" and the current
behavior sound reasonable. Can somebody shed some light? Should this be
documented as a GCC change, or is it a bug?

gcc-c++-4.3.0-0.7.i386

Thanks!
--
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513

--
fedora-test-list mailing list
fedora-test-list@xxxxxxxxxx
To unsubscribe:
https://www.redhat.com/mailman/listinfo/fedora-test-list

template <typename T>
static void ff(int i, void(*f)(T,T))
{
  f(i,1000);
}

void realf(int i, int j = 1000)
{
}

void g()
{
  ff(117, realf);
}

void gg()
{
  realf(37);
}  
-- 
fedora-test-list mailing list
fedora-test-list@xxxxxxxxxx
To unsubscribe: 
https://www.redhat.com/mailman/listinfo/fedora-test-list

[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]

  Powered by Linux