[Boost-bugs] [Boost C++ Libraries] #8564: Variable hiding errors within nested let blocks in Phoenix

Subject: [Boost-bugs] [Boost C++ Libraries] #8564: Variable hiding errors within nested let blocks in Phoenix
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-11 23:41:09


#8564: Variable hiding errors within nested let blocks in Phoenix
--------------------------------+-------------------------------------------
 Reporter: miremare@… | Owner: theller
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: phoenix
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 I encounter errors when using nested let blocks in Phoenix whenever an
 "inner" local variable hides an "outer" local variable. The "Visibility"
 example from the documentation at
 http://www.boost.org/doc/libs/1_53_0/libs/phoenix/doc/html/phoenix/modules/scope/let.html
 also fails. Here is that "Visibility" example as a standalone module which
 fails:

 {{{
 #include <iostream>
 #include <boost/phoenix.hpp>

 namespace phoenix = boost::phoenix;
 using namespace phoenix::local_names;

 int main(int argc, char *argv[])
 {
   phoenix::let(_x = 1, _y = ", World")
   [
     phoenix::let(_x = "Hello") // hides the outer _x
     [
       std::cout << _x << _y // prints "Hello, World"
     ]
   ]();

   return 0;
 }
 }}}

 The errors I receive from GCC 4.7.2, GCC 4.8 snapshot, and Clang 3.2, with
 any of Boost 1.49, 1.53, or trunk, begin as follows:
   GCC: "error: function returning an array"

   Clang: "error: function cannot return array type 'result_type' (aka
 'char [6]')"

 Another failing example provided in Eric Niebler's Stack Overflow answer
 [http://stackoverflow.com/questions/16408770/variable-hiding-within-
 nested-let-blocks-in-boost-phoenix here] is:

 {{{
 int y = 0;
 int x = (phoenix::let(_a = 1, _b = 2)[phoenix::let(_b = 3)[ _a ]])(y);
 }}}

 ...which contrasts with the following example; which does compile:

 {{{
 int y = 0;
 int x = (phoenix::let(_a = 1, _b = 2)[phoenix::let(_b = _1)[ _a ]])(y);
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8564>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC