[Boost-bugs] [Boost C++ Libraries] #9606: Boost.LocalFunction cannot bind pointer variables by reference on gcc/clang

Subject: [Boost-bugs] [Boost C++ Libraries] #9606: Boost.LocalFunction cannot bind pointer variables by reference on gcc/clang
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-01-25 16:44:37


#9606: Boost.LocalFunction cannot bind pointer variables by reference on gcc/clang
---------------------+------------------------------
 Reporter: e4lam@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.54.0
 Severity: Problem | Keywords:
---------------------+------------------------------
 Boost.LocalFunction cannot bind pointer variables by reference on gcc or
 clang. I have tested this against the latest boost code available in
 version 1.55.0 and r86799. I have tested that it works on Visual Studio
 though but not on gcc 4.1 (Linux), 4.6 (Linux), nor clang 5.0 (OSX).
 Here's the test

 {{{
 // Example compile: g++ -I /usr/local/include/boost_1_55_0 -o bug bug.cpp
 #include <boost/local_function.hpp>
 #include <stdio.h>
 int main()
 {
         int x = 1;
         int *px = &x;

         void BOOST_LOCAL_FUNCTION(bind& px, bind& x)
         {
                 printf("INSIDE: &px = %p, &x = %p\n", &px, &x);
         }
         BOOST_LOCAL_FUNCTION_NAME(fubar)

         printf("OUTSIDE: &px = %p, &x = %p\n", &px, &x);
         fubar();

         return 0;
 }
 }}}

 The pointer values output by this program should be identical for both the
 INSIDE and OUTSIDE cases. Notice that value for &px differs.

 I found some ways to sort of make this work but none of them are
 acceptable workarounds for me:
 - Binding pointer variables works perfectly in Boost.ScopeExit for all
 compilers/platforms that I tested
 - Adding "-std=c++0x" to the compiler line also fixes the problem

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9606>
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:15 UTC