Opened 8 years ago

Closed 7 years ago

#11211 closed Bugs (fixed)

Fusion example no longer compiles (BOOST_FUSION_DEFINE_STRUCT)

Reported by: Adrián Etchevarne <adrian.etchevarne@…> Owned by: Joel de Guzman
Milestone: Boost 1.59.0 Component: fusion
Version: Boost 1.58.0 Severity: Regression
Keywords: fusion Cc: flast@…

Description

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.

Attachments (1)

error.txt (14.6 KB ) - added by Adrián Etchevarne <adrian.etchevarne@…> 8 years ago.

Download all attachments as: .zip

Change History (15)

by Adrián Etchevarne <adrian.etchevarne@…>, 8 years ago

Attachment: error.txt added

comment:1 by Adrián Etchevarne <adrian.etchevarne@…>, 8 years ago

Severity: ProblemRegression
Summary: Fusion example no longer compilesFusion example no longer compiles (BOOST_FUSION_DEFINE_STRUCT)

comment:2 by Joel de Guzman, 8 years ago

confirmed clang and g++. i added this test case.

comment:3 by Kohei Takahashi <flast@…>, 8 years ago

Cc: flast@… added
Milestone: To Be DeterminedBoost 1.59.0

Confirmed.

Ah, I see, it's my bad.

The constructors of BOOST_FUSION_DEFINE_STRUCT (might other variations too) is not a template: the constructors of each elements must be constexpr.

in reply to:  3 comment:4 by damien.buhl@…, 8 years ago

Sorry I didn't see you already handled the problem. I made a pull-request on github in between. It is ok for you or you wanted to do something finer ?

comment:5 by Joel de Guzman, 8 years ago

I just added a test case, not a fix. Is there another PR? Anyway, I merged Damien's.

comment:5 by anonymous, 8 years ago

I just added a test case, not a fix. Is there another PR? Anyway, I merged Damien's.

comment:6 by damien.buhl@…, 7 years ago

I added another PR for BOOST_FUSION_DEFINE_INLINE_STRUCT and added some other test cases.

I thought for people who are using the library in version 1.58 right now they can work the issue around with : g++ -DBOOST_CONSTEXPR=

in reply to:  6 comment:7 by Adrián Etchevarne <adrian.etchevarne@…>, 7 years ago

I thought for people who are using the library in version 1.58 right now they can work the issue around with : g++ -DBOOST_CONSTEXPR=

Unfortunately, this workaround doesn't work.

comment:8 by Kohei Takahashi <flast@…>, 7 years ago

I think we should release some patches to fix this issue, like ttps://github.com/boostorg/website/blob/master/feed/history/boost_1_58_0.qbk#L25-L40 .

candidates

  • ttps://github.com/boostorg/fusion/pull/70
  • ttps://github.com/boostorg/fusion/pull/71

comment:9 by Dennis Brentjes <d.brentjes@…>, 7 years ago

Here is another minimal test case that fails to compile (in c++11) but now using BOOST_FUSION_ADAPT_STRUCT. I suspect that it is the same issue.

#include <boost/fusion/adapted/struct.hpp>

struct X {};

BOOST_FUSION_ADAPT_STRUCT(
        X,
)

int main() {
        return 0;
}

in reply to:  9 comment:10 by Kohei Takahashi <flast@…>, 7 years ago

Replying to Dennis Brentjes <d.brentjes@…>:

Here is another minimal test case that fails to compile (in c++11) but now using BOOST_FUSION_ADAPT_STRUCT. I suspect that it is the same issue.

#include <boost/fusion/adapted/struct.hpp>

struct X {};

BOOST_FUSION_ADAPT_STRUCT(
        X,
)

int main() {
        return 0;
}

No, it's not a same issue; you can test with -DBOOST_NO_CXX11_CONSTEXPR flag to disabling BOOST_CONSTEXPR feature.

In original test case, work with -DBOOST_NO_CXX11_CONSTEXPR due to avoiding regression: http://melpon.org/wandbox/permlink/APJ0Vi289gSKA7MO . However, your case dosn't work even defining -DBOOST_NO_CXX11_CONSTEXPR: http://melpon.org/wandbox/permlink/ktex1HEt5w4bplsv .

comment:11 by Dennis Brentjes <d.brentjes@…>, 7 years ago

You are right. It seems it's related to adapting an empty struct. Something which was possible in 1.57. Should I create a separate ticket for this issue?

in reply to:  11 comment:12 by Kohei Takahashi <flast@…>, 7 years ago

Replying to Dennis Brentjes <d.brentjes@…>:

Should I create a separate ticket for this issue?

Yes, please!

Joel, I think this issue is now fixed and can be closed.

comment:13 by Joel de Guzman, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.