Opened 10 years ago

Closed 10 years ago

#7569 closed Bugs (fixed)

Compile Error using BOOST_FUSION_DEFINE_STRUCT_INLINE with VC10 and GCC <4.5

Reported by: oswin.krause@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: fusion
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc:

Description

As laid out on the mailing list, because of too much class nesting, a few compilers won't get the macro to work with partial template spcialisations of the nested classes.

a work around is instead of doing something like this (for example in iterator::deref):

//using (A1, a1)(A2, a2)...(AN, an) as struct arguments
typedef A1 t1_type;
typedef A2 t2_type;
...
t1_type& t1;//linked to a1
t2_type& t2;//linked to a2
...

template<int>
struct deref{};

template<>
struct deref<1>{
    typedef t1_type& type;
    type call(Sequence& seq){
        return seq.t1;
    }
};

use a fusion vector to get rid of the partial template specialisation

typedef boost::fusion::vector<A1&,A2&,...AN&> t_seq;
t_seq t;//tied to a1...an
template<int N>
struct deref{
    typedef result_of::at_c<t_seq,N> type;
    type call(Sequence& seq){
        return at_c<N>(seq.t);
    }
};

Attachments (2)

define-struct-inline-msvc-wknd.patch (10.7 KB ) - added by zeratul976@… 10 years ago.
Patch that implements the workaround
define-struct-inline-msvc-wknd-tests.patch (5.3 KB ) - added by zeratul976@… 10 years ago.
Patch to regression tests

Download all attachments as: .zip

Change History (4)

by zeratul976@…, 10 years ago

Patch that implements the workaround

by zeratul976@…, 10 years ago

Patch to regression tests

comment:1 by zeratul976@…, 10 years ago

I implemented the workaround and tested it with MSVC and various GCC versions, including GCC 4.2. It seems to be working. Oswin, please try it out and let me know if it works for you now.

comment:2 by Joel de Guzman, 10 years ago

Resolution: fixed
Status: newclosed

Patches applied. Thanks!

Note: See TracTickets for help on using tickets.