[Boost-bugs] [Boost C++ Libraries] #13393: [scope_exit] (Boost >= 1.65) VS 2015 internal compiler error in lambda

Subject: [Boost-bugs] [Boost C++ Libraries] #13393: [scope_exit] (Boost >= 1.65) VS 2015 internal compiler error in lambda
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-01-12 10:54:28


#13393: [scope_exit] (Boost >= 1.65) VS 2015 internal compiler error in lambda
------------------------------+------------------------------
 Reporter: Tobias Loew | Owner: Lorenzo Caminiti
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: scope_exit
  Version: Boost 1.65.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------------
 Hi,

 starting from Boost version 1.65 and using VS 2015 Update 3 (MSVC 19.00)
 the
 following code

 int main() {
     auto check_property = []() {
         int test = 0;
         BOOST_SCOPE_EXIT(test) {
             test = 42;
         }BOOST_SCOPE_EXIT_END
     };

     return 0;
 }

 raises an internal compiler error:
 fatal error C1001: An internal error has occurred in the compiler.
 (compiler file 'msc1.cpp', line 1468).
 With earlier Boost versions it compiles fine.

 I figured out that the problem is in <boost/typeof/typeof.hpp>.
 Since commit 12e1fe615a34c9a5e6ebe3ddf629c6491a50aa9d (DanielaE committed
 on
 Apr 14, 2017) in line 214 ff VS 2015 (w/o explicit #defines) includes
 <boost/typeof/decltype.hpp>.
 Before the commit VS 2015 included <boost/typeof/native.hpp>.

 It seems that VS 2015 has problems in lambda when
 <boost/typeof/decltype.hpp> is included.

 Unfortunately, the only way getting back the old behavior was defining
 BOOST_NO_CXX11_DECLTYPE or BOOST_NO_CXX11_TEMPLATE_ALIASES, but this would
 have major side-effects.

 I would propose a new macro called BOOST_TYPEOF_MSVC_NATIVE such that when
 defined <boost/typeof/native.hpp> is included.

 A working solution is replacing lin 18 in <boost/typeof/typeof.hpp> by

 #if !defined(BOOST_TYPEOF_MSVC_NATIVE) &&
 !defined(BOOST_NO_CXX11_DECLTYPE) &&
 !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) &&
 !defined(BOOST_TYPEOF_EMULATION)

 Tobias

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13393>
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 : 2018-01-12 10:58:56 UTC