Subject: Re: [Boost-bugs] Fwd: [Boost C++ Libraries] #11211: Fusion example no longer compiles
From: Damien Buhl (damien.buhl_at_[hidden])
Date: 2015-04-21 07:01:25
Hi Joel,
Thanks for forwarding.
Looks like the support for BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED was
added to DEFINE_STRUCT in a too strong way, which makes it impossible to
use non-constexpr enabled types (namely std::string).
I think the problem comes from the addition of BOOST_CONSTEXPR where
BOOST_FUSION_GPU_ENABLED already was.
In this commit
https://github.com/boostorg/fusion/commit/2114bfca6c8d5e4f7fe2439346e1feddfd550ea6
there is BOOST_CONSTEXPR added for the constructors and assignment
operators.
I think we have to remove the constexpr for this part, because we cannot
add the requirements that the types the users gives to DEFINE_STRUCT are
valid within constant expression.
It also didn't come out by unit-tests runs, because our test are only
done with int types. We have to add types which aren't constant-enabled
to the tests for DEFINE_STRUCT and by the way for ADAPT also.
I understand the idea behind adding BOOST_CONSTEXPR everywhere where
BOOST_FUSION_GPU_ENABLED was, but actually it's not the same : on GPU
there isn't any scenarii where one uses std::string I think, while it is
typical in normal execution platform, and by the way BOOST_CONSTEXPR
shouldn't be in this file.
I've pushed a small commit where it then compiles for me on clang + g++
with C++03,11,14 :
> https://github.com/boostorg/fusion/compare/boostorg:master...daminetreg:feature/fix-for-11211?expand=1
Cheers,
--
Damien Buhl
On 20/04/2015 21:18, Joel de Guzman wrote:
> Hello Kohei, Damien,
>
> Uh oh. Do you know what's happening here?
> I'm getting:
>
> Constexpr constructor never produces a constant expression
>
> How did this slip?
>
> -------- Forwarded Message --------
> Subject: [Boost C++ Libraries] #11211: Fusion example no longer compiles
> Date: Mon, 20 Apr 2015 19:01:29 -0000
> From: Boost C++ Libraries <noreply_at_[hidden]>
> CC: boost-bugs_at_[hidden]
>
> #11211: Fusion example no longer compiles
> -----------------------------------------------------+---------------------
> Reporter: Adrián Etchevarne <adrian.etchevarne@â¦> | Owner: djowel
> Type: Bugs | Status: new
> Milestone: To Be Determined | Component: fusion
> Version: Boost 1.58.0 | Severity: Problem
> Keywords: fusion |
> -----------------------------------------------------+---------------------
> From the manual:
>
> {{{
>
> #include <string>
> #include "boost/fusion/adapted/struct/define_struct.hpp"
>
> // demo::employee is a Fusion sequence
> BOOST_FUSION_DEFINE_STRUCT(
> (demo), employee,
> (std::string, name)
> (int, age))
>
>
> int main()
> {
> }
>
> }}}
>
> It fails to compile with boost 1.58. With boost 1.57, compiles
> successfully.
>
> g++ --std=c++11 test.cpp -I /home/saknussemm/downloads/boost_1_58_0
>
> clang fails with a similar error.
>
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC