[statechart] - problem with sc::transition<> -> invalid use of 'boost::statechart::detail::no_context::no_function [with Event = jm::ffcp::ev_init]' to form a pointer-to-member-func

Hello, I get following error: /opt/boost/include/boost-1_33_1/boost/statechart/transition.hpp:33: error: invalid use of 'boost::statechart::detail::no_context::no_function [with Event = jm::ffcp::ev_init]' to form a pointer-to-member-function /opt/boost/include/boost-1_33_1/boost/statechart/transition.hpp:33: note: a qualified-id is required if I try to compile: #ifndef JM_FFCP_UNINITIALIZED_H #define JM_FFCP_UNINITIALIZED_H #include <boost/mpl/list.hpp> //#include <boost/statechart/custom_reaction.hpp> #include <boost/statechart/simple_state.hpp> #include <boost/statechart/transition.hpp> #include <jm/ffcp/events.h> #include <jm/ffcp/proto.h> namespace jm { namespace ffcp { namespace mpl = boost::mpl; namespace sc = boost::statechart; template< typename SocketDeviceT > struct initialized; template< typename SocketDeviceT > struct uninitialized : public sc::simple_state< uninitialized< SocketDeviceT >, proto< SocketDeviceT > > { typedef mpl::list< // sc::custom_reaction< ev_init > sc::transition< ev_init, initialized< SocketDeviceT > > > reactions; uninitialized() { uninitialized< SocketDeviceT
::custom_static_type_ptr("uninitialized"); }
// sc::result react( ev_init const& ev) // { return this->template transit< initialized< SocketDeviceT > >(); } }; } } #endif // JM_FFCP_UNINITIALIZED_H Any hints? regards, Oliver

Hi Oliver
/opt/boost/include/boost-1_33_1/boost/statechart/transition.hpp:33: error: invalid use of 'boost::statechart::detail::no_context::no_function [with Event = jm::ffcp::ev_init]' to form a pointer-to-member-function /opt/boost/include/boost-1_33_1/boost/statechart/transition.hpp:33: note: a qualified-id is required
I suspect this is only part of the error message. Could you please provide the full message?
if I try to compile: [snip code] Any hints?
I don't see any obvious mistakes, but that doesn't mean much. It is difficult to give hints when you don't provide a short but complete program that I can use to reproduce the error. Starting September 3rd, I'll be away from my computer for four weeks. I'll be reachable by email but can't guarantee any response times. Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Andreas Huber <ahd6974-spamgroupstrap <at> yahoo.com> writes: Hi Andreas,
/opt/boost/include/boost-1_33_1/boost/statechart/transition.hpp:33: error: invalid use of 'boost::statechart::detail::no_context::no_function [with Event = jm::ffcp::ev_init]' to form a pointer-to-member-function /opt/boost/include/boost-1_33_1/boost/statechart/transition.hpp:33: note: a qualified-id is required
I suspect this is only part of the error message. Could you please provide the full message?
I've managed to reproduce that compiler error with gcc 4.1.0. I know that it is not a supported platform, but maybe you are interested on this. The code can be found here: http://usalug.org/pastebin/pastebin.php?show=392 The full compiler error was (gcc 4.1.0): /boost_1_33_1/boost/statechart/transition.hpp: In instantiation of 'default_state<int>': /boost_1_33_1/boost/statechart/state_machine.hpp:691: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct() [with MostDerived = sample_machine<int>, InitialState = default_state<int>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /boost_1_33_1/boost/statechart/state_machine.hpp:706: instantiated from 'boost::statechart::result boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initial_construct_function::operator()() [with MostDerived = sample_machine<int>, InitialState = default_state<int>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' /boost_1_33_1/boost/statechart/null_exception_translator.hpp:33: instantiated from 'boost::statechart::result boost::statechart::null_exception_translator::operator()(Action, ExceptionEventHandler) [with Action = boost::statechart::state_machine<sample_machine<int>, default_state<int>, std::allocator<void>, boost::statechart::null_exception_translator>::initial_construct_function, ExceptionEventHandler = boost::statechart::state_machine<sample_machine<int>, default_state<int>, std::allocator<void>, boost::statechart::null_exception_translator>::exception_event_handler]' /boost_1_33_1/boost/statechart/state_machine.hpp:253: instantiated from 'void boost::statechart::state_machine<MostDerived, InitialState, Allocator, ExceptionTranslator>::initiate() [with MostDerived = sample_machine<int>, InitialState = default_state<int>, Allocator = std::allocator<void>, ExceptionTranslator = boost::statechart::null_exception_translator]' main.cpp:30: instantiated from here /boost_1_33_1/boost/statechart/transition.hpp:33: error: invalid use of 'boost::statechart::detail::no_context::no_function [with Event = sample_event]' to form a pointer-to-member-function /boost_1_33_1/boost/statechart/transition.hpp:33: note: a qualified-id is required make: *** [debug] Error 1 The same code can be compiled with gcc 3.2.3 just fine. Best Regards, -- Zoltan 'cad' Juhasz http://people.inf.elte.hu/cad

Hi Zoltan
I've managed to reproduce that compiler error with gcc 4.1.0. I know that it is not a supported platform, but maybe you are interested on this.
The code can be found here: http://usalug.org/pastebin/pastebin.php?show=392
[snip]
The same code can be compiled with gcc 3.2.3 just fine.
Thanks a lot for the repro. I'll look into it. Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Hi Zoltan
I've managed to reproduce that compiler error with gcc 4.1.0. I know that it is not a supported platform, but maybe you are interested on this.
The code can be found here: http://usalug.org/pastebin/pastebin.php?show=392
[snip]
The same code can be compiled with gcc 3.2.3 just fine.
Thanks a lot for the repro. I'll look into it. Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Andreas Huber wrote:
Thanks a lot for the repro. I'll look into it.
The following version of transition.hpp *might* fix the problem: http://boost.cvs.sourceforge.net/*checkout*/boost/boost/boost/statechart/tra... I coudn't verify this on GCC4.1 but at least it compiles on MSVC7.1 and GCC3.4. Could you please replace your local version of transition.hpp with the above one and report back whether that fixes your problem? Thanks & Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Andreas Huber <ahd6974-spamboostorgtrap <at> yahoo.com> writes:
The following version of transition.hpp *might* fix the problem:
http://boost.cvs.sourceforge.net/*checkout*/boost/boost/boost/statechart/tra... ion.hpp?revision=1.15
I coudn't verify this on GCC4.1 but at least it compiles on MSVC7.1 and GCC3.4. Could you please replace your local version of transition.hpp with the above one and report back whether that fixes your problem?
The previous problem ( http://usalug.org/pastebin/pastebin.php?show=392 ) is solved with gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3), but with gcc32 (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-55.fc5) the following problem arise: g++32 -g -I /boost_1_33_1/ -std=c++98 -pedantic main.cpp -o car_assembler In file included from main.cpp:17: /boost_1_33_1/boost/statechart/transition.hpp:48: no class template named ` no_context' in `boost::statechart::detail' main.cpp:38: object `<expression error>' cannot be used as template argument main.cpp:38: warning: ISO C++ forbids declaration of `reactions' with no type make: *** [debug32] Error 1 There is another problem. The full code can be found here: http://usalug.org/pastebin/pastebin.php?show=411 If you define some post_event, the following error occures with gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3): g++ -g -I /boost_1_33_1/ -std=c++98 -pedantic main.cpp -o car_assembler main.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)': main.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 main.cpp:51: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) make: *** [debug] Error 1 With gcc32 (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-55.fc5): g++32 -g -I /boost_1_33_1/ -std=c++98 -pedantic main.cpp -o car_assembler In file included from main.cpp:19: /boost_1_33_1/boost/statechart/transition.hpp:48: no class template named ` no_context' in `boost::statechart::detail' main.cpp:44: object `<expression error>' cannot be used as template argument main.cpp:44: warning: ISO C++ forbids declaration of `type name' with no type make: *** [debug32] Error 1 Best Regards, -- Zoltan 'cad' Juhasz http://people.inf.elte.hu/cad/

Zoltan \'cad\' Juhasz wrote:
Andreas Huber <ahd6974-spamboostorgtrap <at> yahoo.com> writes:
The following version of transition.hpp *might* fix the problem:
http://boost.cvs.sourceforge.net/*checkout*/boost/boost/boost/statechart/tra... ion.hpp?revision=1.15
I coudn't verify this on GCC4.1 but at least it compiles on MSVC7.1 and GCC3.4. Could you please replace your local version of transition.hpp with the above one and report back whether that fixes your problem?
The previous problem ( http://usalug.org/pastebin/pastebin.php?show=392 ) is solved with gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3), but with gcc32 (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-55.fc5) the following problem arise: [snip errors]
I overlooked that you use the old 1.33.1 compatible version, which is well over a year old now. Many fixes have been applied since then so the only thing that I can suggest is to get the 1.34 branch from CVS and see whether that works for you. It should since this is being tested on both compilers you use, see <http://engineering.meta-comm.com/boost-regression/CVS-RC_1_34_0/developer/statechart.html> Please let me know how it goes. Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

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 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 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.) PS2: And thank you for working this out. Best Regards, -- Zoltan 'cad' Juhasz http://people.inf.elte.hu/cad

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.

Andreas Huber <ahd6974-spamboostorgtrap <at> yahoo.com> writes:
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.
Yes. Absolutely true. I am sorry that I've bothered you with such a foolish mistake. Thank you for solving it!
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).
I can confirm it. I've tested it in another installation, both with 3.2.3 and 3.4.5 and there were no problem. So that must be some local problem too. Thank you again. Best Regards, -- Zoltan 'cad' Juhasz http://people.inf.elte.hu/cad
participants (6)
-
Andreas Huber
-
Andreas Huber
-
Oliver.Kowalke@qimonda.com
-
Zoltan 'cad' Juhasz
-
Zoltan \'cad\' Juhasz
-
Zoltan cad Juhasz