GNOME Bugzilla – Bug 147391
test_lambda does not compile with SUN Forte 5.5
Last modified: 2009-08-15 18:40:50 UTC
With the code from cvs: /sgnome/gnome2.4/forte/sparc-solaris/bin/CC -I. -I. -I.. -I.. -I.. - g -c -o test_lambda.o test_lambda.cc "../sigc++/adaptors/lambda/group.h", line 205: Warning (Anachronism): Type names qualified by template parameters require "typename". "../sigc++/adaptors/lambda/group.h", line 305: Where: While specializing "sigc::lambda_group2<sigc::T_functor, sigc::T_type1, sigc::T_type2>". "../sigc++/adaptors/lambda/group.h", line 305: Where: Specialized in non-template code. "../sigc++/adaptors/lambda/group.h", line 333: Warning (Anachronism): Type names qualified by template parameters require " typename". "../sigc++/adaptors/lambda/group.h", line 435: Where: While specializing "sigc::lambda_group3<sigc::T_functor, sigc::T_type1, sigc::T_type2, sigc::T_type3>". "../sigc++/adaptors/lambda/group.h", line 435: Where: Specialized in non-template code. "test_lambda.cc", line 61: Error: Overloading ambiguity between "sigc::operator+<sigc::internal::lambda_select1, sigc::internal::lambda_select2>(const sigc::lambda<sigc::internal::lambda_select1>&, const sigc::lambda<sigc::internal::lambda_select2>&)" and "sigc::operator +<sigc::internal::lambda_select1, sigc::lambda<sigc::internal::lambda_select2>>(const sigc::lambda<sigc::internal::lambda_select1>&, sigc::lambda<sigc::internal::lambda_select2>)". "test_lambda.cc", line 66: Error: Overloading ambiguity between "sigc::operator*<sigc::internal::lambda_select2, sigc::internal::lambda_select3>(const sigc::lambda<sigc::internal::lambda_select2>&, const sigc::lambda<sigc::internal::lambda_select3>&)" and "sigc::operator*<sigc::internal::lambda_select2, sigc::lambda<sigc::internal::lambda_select3>>(const sigc::lambda<sigc::internal::lambda_select2>&, sigc::lambda<sigc::internal::lambda_select3>)". "test_lambda.cc", line 66: Error: Overloading ambiguity between "sigc::operator+<sigc::internal::lambda_select1, sigc::lambda_operator<sigc::arithmetic<sigc::multiplies>, sigc::internal::lambda_select2, sigc::internal::lambda_select3>>(const sigc::lambda<sigc::internal::lambda_select1>&, const sigc::lambda<sigc::lambda_operator<sigc::arithmetic<sigc::multiplies>, sigc::internal::lambda_select2, sigc::internal::lambda_select3>>&)" and "sigc::operator+<sigc::internal::lambda_select1, sigc::lambda<sigc::lambda_operator<sigc::arithmetic<sigc::multiplies>, sigc::internal::lambda_select2, sigc::internal::lambda_select3>>>(const sigc::lambda<sigc::internal::lambda_select1>&, sigc::lambda<sigc::lambda_operator<sigc::arithmetic<sigc::multiplies>, sigc::internal::lambda_select2, sigc::internal::lambda_select3>>)". "test_lambda.cc", line 86: Error: Overloading ambiguity between "sigc::operator<<<std::ostream &, sigc::internal::lambda_select1>(const sigc::lambda<std::ostream &>&, const sigc::lambda<sigc::internal::lambda_select1>&)" and "sigc::operator<<<std::ostream &, sigc::lambda<sigc::internal::lambda_select1>>(const sigc::lambda<std::ostream &>&, sigc::lambda<sigc::internal::lambda_select1>)". 4 Error(s) and 2 Warning(s) detected. make[2]: *** [test_lambda.o] Error 4 make[2]: Leaving directory `/jds/libsigc/libsigc++-2.0.3/tests' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/jds/libsigc/libsigc++-2.0.3'
Unfortunately my efforts to avoid overloading the lambda action operators failed: E.g. template <class T1, class T2> lambda<lambda_operator<[bla]> > operator + (const T1& a1, const T2& a2) doesn't work because then operator+ would be redefined for every type in namespace sigc. At least T1 or T2 need to be of type lambda (like e.g. the lambda selector sigc::_1), hence the current definition with overloads: template <class T1, class T2> lambda<lambda_operator<[bla]> > operator + (const lambda<T1>& a1, T2 a2) template <class T1, class T2> lambda<lambda_operator<[bla]> > operator + (T1 a1, const lambda<T2>& a2) template <class T1, class T2> lambda<lambda_operator<[bla]> > operator + (const lambda<T1>& a1, const lambda<T2>& a2) Making the operators members of the class template lambda also doesn't work - at least gcc doesn't find any matches for expressions like "_1 + 1" (don't ask me why; a test where "operator+" was not defined as a function template but for the fixed argument type "int" succeeded). The only possible solution I can see at the moment is to restrict the syntax for the FORTE. E.g. having only template <class T1, class T2> lambda<lambda_operator<[bla]> > operator + (const lambda<T1>& a1, const T2& a2) would allow expressions like (_1 + 1)(123) (_1 + _2)(123,456) whereas (1 + _1)(123) wouldn't compile. A valid syntax, though, would be: (sigc::constant(1) + _1)(123) because sigc::constant(1) creates a lambda object. What's your opinion?
I'm not sure what API/syntax/abilities this lambda stuff even gives, but if it's not essential then I think it's fine to disable it on platforms that don't support it.
I've added a configure check for this problem. The operator overloads now should be disabled for the FORTE.
Could you confirm that this is fixed, please?
If you put a test or release tarball online then Damien can test it for us. Sorry, I can't do that right now.
Okay, new test tarball uploaded to: http://www.hippogriff.de/libsigc++-2.0.3-test-forte.tar.gz Damien, could you please make a try, once again? With any luck, we should get past test_lambda now. Thanks!
It failed again! I've asked Damien to send his sigc++config.h since the configure check I've added obviously doesn't work. It should fail with the Forte because it simulates the code of the lambda operator overloads which doesn't compile.
In principle this is fixed in cvs and 2.0.4 (see ChangeLog). Issue left: the expression 'sigc::var("\n")' doesn't compile with the FORTE (also see comment in sigc++/adaptors/lambda/macros/base.h.m4).