Re: [sigc] libsigc++ 1.9.13 fails on Solaris 9 sparc
- From: Martin Schulze <martin-ml hippogriff de>
- To: Damien Carbery <Damien Carbery Sun COM>
- Cc: Murray Cumming <murrayc murrayc com>, libsigc-list gnome org
- Subject: Re: [sigc] libsigc++ 1.9.13 fails on Solaris 9 sparc
- Date: Sat, 28 Feb 2004 10:35:27 +0100
Am 2004.02.28 00:52 schrieb(en) Damien Carbery:
Replaced test_functor_trait.cc. Compilation seemed to get by that
file.
Failed in test_mem_fun.c though.
I'm attaching new versions of test_mem_fun.cc and test_ptr_fun.cc
that should compile. Is there a macro that we can use to test
whether we are using the FORTE?
It seams that we spotted a compiler feature that is currently not
supported by the FORTE: it cannot deduce which method overload to
use when forming a function pointer with specialized template
parameter types. That means:
struct test {
void foo(char);
void foo(float);
}
sigc::slot<void,char> = sigc::mem_fun1<char>(&test::foo);
won't work with the FORTE because it cannot deduce which overload
of method foo it should use. Maybe this is even a compiler bug.
Meanwhile, we can only remove this feature from the test cases.
The problem might arise with other test cases as well because
working with overloaded functions and methods is tested quite
extensively. However, I don't think there is anything we can do
on the API side to help the FORTE here.
Regards,
Martin
// -*- c++ -*-
/* Copyright 2002, The libsigc++ Development Team
* Assigned to public domain. Use as you wish without restriction.
*/
#include <sigc++/functors/mem_fun.h>
#include <iostream>
struct test
{
void foo(short i1)
{std::cout << "const test::foo(short "<< i1<< ')' <<std::endl; }
void foo_const(int i1) const
{std::cout << "const test::foo(int "<< i1<< ')' <<std::endl; }
void foo_volatile(float i1) volatile
{std::cout << "const test::foo(float "<< i1<< ')' <<std::endl; }
void foo_const_volatile(double i1) const volatile
{std::cout << "const test::foo(double "<< i1<< ')' <<std::endl; }
void foo_overloaded(char i1)
{std::cout << "const test::foo(char "<< (int)i1<< ')' <<std::endl; }
/* TODO: put something like #ifndef FORTE ... #endif around:
void foo_overloaded(short i1)
{std::cout << "const test::foo(char "<< (int)i1<< ')' <<std::endl; } */
double foo_overloaded(int i1,int i2)
{std::cout << "test::foo("<<i1<<','<<i2<< ')' <<std::endl; return 1.0;}
};
int main()
{
{ /* test non-const */
test t;
sigc::mem_fun(&test::foo)(t,1); // on reference
sigc::mem_fun(&test::foo)(&t,1); // on pointer
}
{ /* test const */
test t;
sigc::mem_fun(&test::foo_const)(t,2);
sigc::mem_fun(&test::foo_const)(&t,2);
}
{ /* test const with const object */
const test t=test();
sigc::mem_fun(&test::foo_const)(t,3);
sigc::mem_fun(&test::foo_const)(&t,3);
}
{ /* test non-const volatile */
test t;
sigc::mem_fun(&test::foo_volatile)(t,4); // on reference
sigc::mem_fun(&test::foo_volatile)(&t,4); // on pointer
}
{ /* test const volatile */
test t;
sigc::mem_fun(&test::foo_const_volatile)(t,5); // on reference
sigc::mem_fun(&test::foo_const_volatile)(&t,5); // on pointer
}
{ /* test const volatile with const object */
const test t=test();
sigc::mem_fun(&test::foo_const_volatile)(t,6); // on reference
sigc::mem_fun(&test::foo_const_volatile)(&t,6); // on pointer
}
{ /* test overloaded */
test t;
/* TODO: put something like #ifndef FORTE ... #else ... #endif around:
sigc::mem_fun1<char>(&test::foo_overloaded)(&t,7);
sigc::mem_fun1<short>(&test::foo_overloaded)(&t,7); and: */
sigc::mem_fun1(&test::foo_overloaded)(&t,7);
sigc::mem_fun2(&test::foo_overloaded)(&t,7,8);
}
{ /* test bound */
test t;
sigc::mem_fun(t,&test::foo)(9);
sigc::mem_fun(&t,&test::foo)(9);
sigc::mem_fun(t,&test::foo_const)(9);
sigc::mem_fun(&t,&test::foo_const)(9);
sigc::mem_fun(t,&test::foo_volatile)(9);
sigc::mem_fun(&t,&test::foo_volatile)(9);
sigc::mem_fun2(t,&test::foo_overloaded)(9,10);
sigc::mem_fun2(&t,&test::foo_overloaded)(9,10);
}
}
// -*- c++ -*-
/* Copyright 2002, The libsigc++ Development Team
* Assigned to public domain. Use as you wish without restriction.
*/
#include <iostream>
#include <sigc++/functors/ptr_fun.h>
int foo()
{std::cout << "foo()" << std::endl; return 1;}
void foo(int i1)
{std::cout << "foo(int "<<i1<<")" << std::endl;}
/* TODO: put something like #ifndef FORTE ... #endif around:
void bar(char i1)
{std::cout << "foo(char "<<(int)i1<<")" << std::endl;} */
void bar(float i1)
{std::cout << "foo(float "<<i1<<")" << std::endl;}
double bar(int i1,int i2)
{std::cout << "foo(int "<<i1<<", int "<<i2<< ")" <<std::endl; return 1.0f;}
struct test {
static void foo() {std::cout << "test::foo()" <<std::endl;}
};
int main()
{
sigc::ptr_fun0(&foo)();
sigc::ptr_fun1(&foo)(1);
/* TODO: put something like #ifndef FORTE ... #else ... #endif around:
sigc::ptr_fun1<char>(&bar)(2);
sigc::ptr_fun1<float>(&bar)(2.0f); and: */
sigc::ptr_fun1(&bar)(2.0f);
sigc::ptr_fun2(&bar)(3,5);
sigc::ptr_fun(&test::foo)();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]