Problems compiling with BOOST_FUSION_ADAPT_ADT

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems compiling with BOOST_FUSION_ADAPT_ADT

Gregory Haskins
Hello,

I have been using Spirit for years now primarily via
BOOST_FUSION_ADAPT_STRUCT.  In that model, I would typically have
intermediate AST structures that would be post-spirit processed into
application specific structures.

I recently was playing around with trying to work with Google Protocol
buffers + Spirit to have a (pre-existing) message definition CSV file
be imported in a way that it populates some message objects.  In this
model, it would be ideal to not need to replicate all the Protobuf
structures in the AST.  However, to accomplish this I would need to be
able to work with the getters/setters as emitted by the protobuf
compiler.  Reading through the documentation, it seems like I could
possibly accomplish this by using BOOST_FUSION_ADAPT_ADT rather than
an custom intermediates.  However, when I tried to implement the idea,
the compiler exploded.

So, I tried to come up with a simple test case to reproduce so I could
ask for help.  The good news is, the test harness also fails to
compile.  The bad news is, its not quite the same error.  However, I
figure I would ask for help regardless because perhaps it will still
allow me to understand what is wrong in the real program.

I would appreciate any help understanding the following.

This code (using my more traditional model of ADAPT_STRUCT) works fine:

https://gist.github.com/ghaskins/d64bed453e727b076523

------------------------
ghaskins@ubuntu:~/sandbox/git/spirit$ g++ -g -O0 -std=c++11 -o
spirittest main.cc
ghaskins@ubuntu:~/sandbox/git/spirit$ ./spirittest
1,2
3,4
------------------------

Whereas this code (modified to use ADAPT_ADT via getters/setters:

https://gist.github.com/ghaskins/c492171f5b2a8197bf48

yields the following compiler error:

https://gist.github.com/ghaskins/5e4c8eed37a2c87631de

This is on Ubuntu 15.04 with Boost v1.58.  Any help sorting this out
would be greatly appreciated.

Kind Regards,
-Greg

------------------------------------------------------------------------------
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Problems compiling with BOOST_FUSION_ADAPT_ADT

teajay-2
Le 02/10/2015 04:53, Gregory Haskins a écrit :

> Hello,
>
> I have been using Spirit for years now primarily via
> BOOST_FUSION_ADAPT_STRUCT.  In that model, I would typically have
> intermediate AST structures that would be post-spirit processed into
> application specific structures.
>
> I recently was playing around with trying to work with Google Protocol
> buffers + Spirit to have a (pre-existing) message definition CSV file
> be imported in a way that it populates some message objects.  In this
> model, it would be ideal to not need to replicate all the Protobuf
> structures in the AST.  However, to accomplish this I would need to be
> able to work with the getters/setters as emitted by the protobuf
> compiler.  Reading through the documentation, it seems like I could
> possibly accomplish this by using BOOST_FUSION_ADAPT_ADT rather than
> an custom intermediates.  However, when I tried to implement the idea,
> the compiler exploded.
>
> So, I tried to come up with a simple test case to reproduce so I could
> ask for help.  The good news is, the test harness also fails to
> compile.  The bad news is, its not quite the same error.  However, I
> figure I would ask for help regardless because perhaps it will still
> allow me to understand what is wrong in the real program.
>
> I would appreciate any help understanding the following.
>
> This code (using my more traditional model of ADAPT_STRUCT) works fine:
>
> https://gist.github.com/ghaskins/d64bed453e727b076523
>
> ------------------------
> ghaskins@ubuntu:~/sandbox/git/spirit$ g++ -g -O0 -std=c++11 -o
> spirittest main.cc
> ghaskins@ubuntu:~/sandbox/git/spirit$ ./spirittest
> 1,2
> 3,4
> ------------------------
>
> Whereas this code (modified to use ADAPT_ADT via getters/setters:
>
> https://gist.github.com/ghaskins/c492171f5b2a8197bf48
>
> yields the following compiler error:
>
> https://gist.github.com/ghaskins/5e4c8eed37a2c87631de
>
> This is on Ubuntu 15.04 with Boost v1.58.  Any help sorting this out
> would be greatly appreciated.
>
> Kind Regards,
> -Greg
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Spirit-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/spirit-general
Hello Greg,

I think you will need to upgrade to a newer boost version or apply the
patch mentioned in this thread:

http://boost.2283326.n4.nabble.com/spirit-unable-to-use-BOOST-FUSION-ADAPT-ADT-adapted-structs-tp4679425p4679544.html

Regards,

Thomas Bernard

------------------------------------------------------------------------------
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general