[Boost-bugs] [Boost C++ Libraries] #6590: BOOST_AUTO fails on C++11 lambdas

Subject: [Boost-bugs] [Boost C++ Libraries] #6590: BOOST_AUTO fails on C++11 lambdas
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-21 22:46:09


#6590: BOOST_AUTO fails on C++11 lambdas
----------------------------------------------+-----------------------------
 Reporter: Anders Kaseorg <andersk@…> | Owner: burbelgruff
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: typeof
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: |
----------------------------------------------+-----------------------------
 `BOOST_AUTO` fails on C++11 lambdas as follows (tested with g++
 4.6.2-14ubuntu2):
 {{{
 #!C++
 #include <boost/typeof/typeof.hpp>
 BOOST_AUTO(f, [](){});
 }}}
 {{{
 $ g++ -c -std=c++0x test.cc
 test.cc:2:1: error: lambda-expression in unevaluated context
 test.cc:2:1: error: conversion from ‘<lambda()>’ to non-scalar type
 â€˜<lambda()>’ requested
 }}}

 Although it’s apparently not possible to use `typeof` or `decltype` on a
 lambda expression, this could be fixed by defining `BOOST_AUTO` with C++11
 `auto` on compilers that support it:
 {{{
 #!C++
 #define BOOST_AUTO(Var, Expr) auto Var = Expr
 BOOST_AUTO(f, [](){});
 }}}

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