Please find attached a sample program, which does not compile.
Unfortunately this program depends on boost. I use the current boost version 1.33.1. The include files "algorithm" and "iostream" are the ones belonging to gcc-4.1.1.
Created attachment 12493 [details]
test.cpp (sample program that does not compile)
This program does not compile (commandline g++ test.cpp -o test)
Can you provide the preprocessed source which you can get via -save-temps and it will be called something .ii.
Also you can provide the error message you get?
Created attachment 12494 [details]
output of g++ test.cpp -o test
Created attachment 12495 [details]
output of Visual C++ .NET 2003 plus output of compiled program
test.ii produced by `g++ -v -save-temps test.cpp -o test' is to bug for bugzilla -- you can find it here:
Remark to test.cpp:23:
std::cout << boost::lambda::_1 << '\n'
This should find the overloaded operator<< defined in boost/tuple_io.hpp.
Created attachment 12500 [details]
test2.cpp (sample program that does not compile)
I managed to simplify the program.
Created attachment 12501 [details]
output of 'g++ test2.cpp -o test2'
Created attachment 12502 [details]
output of compiler shipped with MS Visual C++ 2005 Express Edition and program output
test2.ii produced by `g++ -v -save-temps test2.cpp -o test2' is to big for
bugzilla -- you can find it here:
I believe the testcase is invalid. EDG says:
test.cpp(5824): error: no instance of overloaded function "boost::lambda::lambda_functor<T>::operator() [with T=boost::lambda::placeholder<1>]" matches the argument list
argument types are: (std::pair<int, int>)
object type is: boost::lambda::placeholder1_type
std::cout << (boost::lambda::_1)(std::make_pair(a, b)) << std::endl;
compilation aborted for test.cpp (code 2)
Created attachment 12503 [details]
(In reply to comment #11)
> I believe the testcase is invalid.
You're right, therefore I'm closing this bug. The author of the Boost.Lambda library, Jaakko Järvi, kindly pointed my to a section of the library documentation, where it is written that arguments to lambda functions can't be non-const rvalues.
The following patch corrects the test case:
--- test2.cpp.~1~ 2006-10-27 11:02:14.000000000 +0200
+++ test2.cpp 2006-10-30 18:05:06.000000000 +0100
@@ -11,6 +11,8 @@
int a = 1, b = 2;
- std::cout << (boost::lambda::_1)(std::make_pair(a, b)) << std::endl;
+ << (boost::lambda::_1)(boost::lambda::make_const(std::make_pair(a, b)))
+ << std::endl;
I don't know why it compiles cleanly on VC++, though.
However, my initial testcase (attachment #12493 [details]) does still not compile, so it seems I have simplified it wrongly. I will check this back and reopen the bug accordingly.