Opened 3 years ago

Closed 3 years ago

#11269 closed Bugs (fixed)

Fusion adapting an "empty" struct is no longer possible in boost 1.58

Reported by: Dennis Brentjes <d.brentjes@…> Owned by: Joel de Guzman
Milestone: To Be Determined Component: fusion
Version: Boost 1.58.0 Severity: Regression
Keywords: Cc:

Description

The following examples fails to compile with boost 1.58 with -std=c++11, but does compile with 1.57 (and -std=c++11). If you test the code with the 1.58 release you need to add the -DBOOST_NO_CXX11_CONSTEXPR flag to workaround #11211

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

struct X {};

BOOST_FUSION_ADAPT_STRUCT(
        X,
)

int main() {
        return 0;
}

Change History (6)

comment:1 Changed 3 years ago by damien.buhl@…

We did not had this usage in our testcases and I didn't even thought about it as an interesting use of adapt struct.

I understand however now that one might want to do this. I'm looking at it, I might fix this fast.

comment:2 Changed 3 years ago by damien.buhl@…

There is a workaround for your issue until I get it fixed. Compile with the following flag disabled:

g++ -DBOOST_PP_VARIADICS=0 main.cpp

This will take the code path using sequences only which works as in 1.57. I'm still fixing the other case however.

comment:3 Changed 3 years ago by damien.buhl@…

So I have a fix working and passing all tests + this new test case with or without VARIADICS enabled.

Is there other use case than ADAPT_STRUCT with empty struct ? Do you think ADAPT_ADT might also be needed with empty struct ? ASSOC_STRUCT?

djowel can you remember which use cases might makes sense ?

The fix is for the moment in my branch on github : daminetreg/fusion branch : feature/fix-ticket-11269-adapt-empty-struct

I also made a PR for it in github boostorg/fusion#75

comment:4 Changed 3 years ago by Joel de Guzman

We should probably support all cases of empy structs/classes. it's kind wiered with ADAPT_ADT, but i can't tell when someone will use such a thing. maybe in generic code?

comment:5 Changed 3 years ago by damien.buhl@…

Happily since my PR #75 we do support all cases of empty structs/classes. I made a new PR #76 with all the testcases.

This bug is fixed. :)

comment:6 Changed 3 years ago by Joel de Guzman

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