Boost logo

Boost Users :

From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2007-03-13 20:19:24


Zoltan \'cad\' Juhasz wrote:
> Andreas Huber <ahd6974-spamboostorgtrap <at> yahoo.com> writes:
>> Please let me know how it goes.
>
> Unfortunately not so well.
>
> I downloaded the current version from CVS.
>
> test_a == http://usalug.org/pastebin/pastebin.php?show=392
> test_b == http://usalug.org/pastebin/pastebin.php?show=411
>
> gcc41 == (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3),
> gcc32 == (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-55.fc5)
>
> gcc41 test_a -> success
>
>
> gcc41 test_b -> g++ -g -I /boost_1_34_alpha/ -std=c++98 -pedantic
> test.cpp -o test
> test.cpp: In constructor 'default_state<T>::default_state(typename
> boost::statechart::state<default_state<T>, sample_machine<T>,
> boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na>, has_no_history>::my_context)':
> test.cpp:51: error: there are no arguments to 'post_event' that
> depend on a template parameter, so a declaration of 'post_event' must
> be available test.cpp:51: error: (if you use '-fpermissive', G++ will
> accept your code, but allowing the use of an undeclared name is
> deprecated)
> make: *** [debug34_test] Error 1

After studying the error a bit closer, I believe the problem lies in
your code. If I'm not mistaken this is caused by the fact that
post_event is called in a class template and is declared in a base that
depends on a template parameter. Try this->post_event instead of
post_event and the error should go away.

> gcc32 test_a -> g++32 -g -I /boost_1_34_alpha/ -std=c++98 -pedantic
> test.cpp -o test
> In file included from test.cpp:17:
> /boost_1_34_alpha/boost/statechart/transition.hpp:48: no class
> template named ` no_context' in `boost::statechart::detail'
> test.cpp:38: object `<expression error>' cannot be used as template
> argument test.cpp:38: warning: ISO C++ forbids declaration of
> `reactions' with no type make: *** [debug3432_test] Error 1
>
>
> gcc32 test_b -> g++32 -g -I /boost_1_34_alpha/ -std=c++98 -pedantic
> test.cpp -o test
> In file included from test.cpp:19:
> /boost_1_34_alpha/boost/statechart/transition.hpp:48: no class
> template named ` no_context' in `boost::statechart::detail'
> test.cpp:44: object `<expression error>' cannot be used as template
> argument test.cpp:44: warning: ISO C++ forbids declaration of `type
> name' with no type test.cpp:68:2: warning: no newline at end of file
> make: *** [debug3432_test] Error 1

I'm a bit stumped by these errors. It seems test_a is more than covered
by the test case TransitionTest and the BitMachine example, both of
which compile on gcc 3.2.3 on linux (see test results by Martin Wille).

> PS: To tell the truth gcc41 is more inportant to me than gcc32,
> although with the "-fpermissive" flag, it can be compiled with
> gcc41... but it is still ugly. (I do not know what kinds of impact
> that flag implies.)

Ok, I think it should work when you prepend this-> before every base
class method call that is made in a derived class template.

-- 
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header. 

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net