Opened 11 years ago

Closed 5 years ago

#5824 closed Bugs (fixed)

Block statement docs do not mention necessary header file

Reported by: gredner@… Owned by: Thomas Heller
Milestone: To Be Determined Component: phoenix
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

In the documentation for block statements [1], there is no mention of the needed header file (scope.hpp, I think?). This is particularly insidious because block statements will compile without this header, but they will silently generate the wrong runtime code (only the last statement in the comma-chain will be executed).

[1] http://www.boost.org/doc/libs/1_47_0/libs/phoenix/doc/html/phoenix/modules/statement/block_statement.html

Attachments (1)

main.cpp (323 bytes ) - added by gredner@… 11 years ago.
Self-contained test case illustrating the problem. The program compiles cleanly (with g++ 4.4.5 -Wall -Wextra -pedantic) both with and without the marked #include, but its observable behavior differs.

Download all attachments as: .zip

Change History (4)

comment:1 by Thomas Heller, 11 years ago

Can you provide a testcase that shows the wrong behaviour?

by gredner@…, 11 years ago

Attachment: main.cpp added

Self-contained test case illustrating the problem. The program compiles cleanly (with g++ 4.4.5 -Wall -Wextra -pedantic) both with and without the marked #include, but its observable behavior differs.

comment:2 by John Fletcher <J.P.Fletcher@…>, 9 years ago

The problem is caused by the inclusion of a comma and therefore of a need to handle the comma correctly.

As with 5715 the problem is that the user needs to include a header which is not obvious. The sensible way to deal with this is to take away that need by putting the extra header into something which is going to be included anyway given the nature of the user's problem. This is a little tricky as there is no obvious place to put an extra header which will get naturally included by a user. I have gone for the following.

Put #include <boost/phoenix/scope/local_variable.hpp> into BOTH boost/phoenix/operator.hpp AND boost/phoenix/core.hpp

Test bug5824 has been included in the test suite.

comment:3 by Kohei Takahashi, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.