Hi everybody, I found a bug of Boost.Typeof emulation mode

#include <boost/typeof/typeof.hpp> #include <boost/static_assert.hpp> int a = 0; int& b = a; BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(b), int&>::value));

On 6/2/07, Atry <pop.atry@gmail.com> wrote:
#include <boost/typeof/typeof.hpp> #include <boost/static_assert.hpp> int a = 0; int& b = a; BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(b), int&>::value));
IIRC (do not have the docs at hand right now), BOOST_TYPEOF drops toplevel references. So does gcc builtin typeof and, I think, the proposed 'auto' type deduction (while decltype should preserve them). HTH, gpd

Giovanni Piero Deretta wrote:
On 6/2/07, Atry <pop.atry@gmail.com> wrote:
#include <boost/typeof/typeof.hpp> #include <boost/static_assert.hpp> int a = 0; int& b = a; BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(b), int&>::value));
IIRC (do not have the docs at hand right now), BOOST_TYPEOF drops toplevel references. So does gcc builtin typeof and, I think, the proposed 'auto' type deduction (while decltype should preserve them).
HTH,
gpd _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thanks. But is there any way to determine if an expression is reference?

Atry wrote:
Giovanni Piero Deretta wrote:
On 6/2/07, Atry <pop.atry@gmail.com> wrote:
#include <boost/typeof/typeof.hpp> #include <boost/static_assert.hpp> int a = 0; int& b = a; BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(b), int&>::value));
IIRC (do not have the docs at hand right now), BOOST_TYPEOF drops toplevel references. So does gcc builtin typeof and, I think, the proposed 'auto' type deduction (while decltype should preserve them).
HTH,
gpd _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thanks. But is there any way to determine if an expression is reference?
In other word, how to know whether the expression is l-value; #include <iostream> void x(int&) { std::cout << "l-value" << std::endl; } void x(int) { std::cout << "r-value" << std::endl; } int main() { x(1); // r-value; int i = 1; int& j = i; x(i); // expect l-value, but error. x(j); // expect l-value, but error. }

Atry wrote:
In other word, how to know whether the expression is l-value;
Use the search... <http://thread.gmane.org/gmane.comp.lib.boost.devel/135828> -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo
participants (5)
-
Atry
-
Eric Niebler
-
Giovanni Piero Deretta
-
Maurizio Vitale
-
Rene Rivera