Opened 11 years ago

Last modified 10 years ago

#5687 reopened Bugs

some evaluation functions do not work with BOOST_RESULT_OF_USE_DECLTYPE

Reported by: Michel MORIN <mimomorin@…> Owned by: Thomas Heller
Milestone: To Be Determined Component: phoenix
Version: Boost 1.47.0 Severity: Problem
Keywords: C++0x Cc:

Description

Codes using phoenix::construct fail to compile in C++0x with BOOST_RESULT_OF_USE_DECLTYPE (Tested on gcc 4.6.1 and clang TOT). Here is a minimal test code:

#define BOOST_RESULT_OF_USE_DECLTYPE

#include <boost/phoenix/core.hpp>
#include <boost/phoenix/object/construct.hpp>

int main (int argc, char* argv[])
{
    boost::phoenix::construct<int>()();
    
    return 0;
}

Also, you can get the compile error by compiling libs/phoenix/test/object/new_delete_tests.cpp with BOOST_RESULT_OF_USE_DECLTYPE.

Change History (13)

comment:1 by Michel MORIN <mimomorin@…>, 11 years ago

phoenix::new_ does not work with BOOST_RESULT_OF_USE_DECLTYPE, too.

comment:2 by Thomas Heller, 11 years ago

Status: newassigned

comment:3 by Thomas Heller, 11 years ago

Resolution: fixed
Status: assignedclosed

Thanks for the report, fixed on trunk.

comment:4 by Thomas Heller, 11 years ago

Version: Boost Development TrunkBoost 1.47.0

comment:5 by Michel MORIN <mimomorin@…>, 11 years ago

Confirmed the fix. Thanks for your quick work, Thomas!

BTW, many other structs (xxxx_eval) need this kind of fixes. Could you run the tests (libs/phoenix/test) with defining BOOST_RESULT_OF_USE_DECLTYPE? Then, you'll see many compiler errors.

Of course, if you want, I can run the tests and report which files need to be fixed. (But it might take some time, since my knowledge about bjam is scarse.)

comment:6 by Thomas Heller, 11 years ago

Resolution: fixed
Status: closedreopened
Summary: phoenix::construct does not work with BOOST_RESULT_OF_USE_DECLTYPEsome evaluation functions do not work with BOOST_RESULT_OF_USE_DECLTYPE

Something went wrong then, thought i ran the tests with this compiler flag. Will check it again. FWIW, this is how my user_config.jam (in my home directory) looks like for gcc with C++0x enabled:

using gcc
    : c++0x
    : /usr/bin/g++
    : <compileflags>"-DBOOST_RESULT_OF_USE_DECLTYPE --std=c++0x -ansi -pedantic -Wextra -Wno-long-long -Wno-sign-compare -Wno-unused-function -Wno-deprecated -Wno-missing-braces"
    ;

invoke bjam with toolset=gcc-c++0x and it should work.

Bug is reopened until everything else is fixed.

comment:7 by Thomas Heller, 11 years ago

update: It must read:

using gcc
    : c++0x
    : /usr/bin/g++
    : <compileflags>"-DBOOST_RESULT_OF_USE_DECLTYPE -ansi -pedantic --std=c++0x -Wextra -Wno-long-long -Wno-sign-compare -Wno-unused-function -Wno-deprecated -Wno-missing-braces"
    ;

comment:8 by Michel MORIN <mimomorin@…>, 11 years ago

Just to be clear: the bugs in phoenix::construct and phoenix::new_ are already fixed (and no new bugs are created by the fix).

In my last comment, I just reported that there are similar bugs in phoenix. For example, libs/phoenix/test/statement/if_tests.cpp fails to compile.

Sorry for confusing you. Should I make another ticket?

comment:9 by Thomas Heller, 11 years ago

No confusion happened ;)

I renamed the ticket. So I think it should be fine. Also, the fix is almost done ... running tests right now.

comment:10 by Michel MORIN <mimomorin@…>, 11 years ago

Ah, I missed the new title of the ticket!

And thanks for the hint about bjam, now I can run the tests with BOOST_RESULT_OF_USE_DECLTYPE :)

comment:11 by Thomas Heller, 11 years ago

Milestone: Boost 1.48.0To Be Determined

comment:12 by Michel Morin, 10 years ago

Thomas, what is the current situation of this ticket?

In trunk, decltype-based result_of is enabled by default on a compiler with N3276 decltype support (such as clang 3.1). This means that some existing codes fail to compile on such compilers. (Users have an option to disable decltype-based result_of by defining BOOST_RESULT_OF_USE_TR1.)

I tested Boost.Phoenix on clang (which implements N3276 decltype) in a C++11 mode. The following tests fail to compile:

  • libs/phoenix/test/bind_not_test.test
  • libs/phoenix/test/bind_rv_sp_test.test
  • libs/phoenix/test/bind_stateful_test.test
  • libs/phoenix/test/bind_test.test
  • libs/phoenix/test/bug3289.test
  • libs/phoenix/test/dynamic_tests.test
  • libs/phoenix/test/exceptions.test
  • libs/phoenix/test/if_tests.test
  • libs/phoenix/test/lambda_tests.test
  • libs/phoenix/test/loops_tests.test
  • libs/phoenix/test/member.test
  • libs/phoenix/test/new_delete_tests.test
  • libs/phoenix/test/switch_tests.test

You can see the error messages at http://www.boost.org/development/tests/trunk/developer/phoenix.html (clang-cxx11-r156741 test runner).

Also, some tests of Boost.Spirit fail to compile due to the dependency on Boost.Phoenix:

  • libs/spirit/test/lex_regression_file_iterator3-p3.test

comment:13 by Mehmet Ozan Kabak <wanderer2@…>, 10 years ago

I also encountered this problem in 1.51 release, so it seems to still need fixing.

Note: See TracTickets for help on using tickets.