Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-04-27 15:24:17


Doug Gregor wrote:
>
>> The other problem is:
>> ../boost/xpressive/detail/core/state.hpp:95: error: declaration of
>> 'typedef struct boost::xpressive::detail::match_context<BidiIter>
>> boost::xpressive::detail::match_state<BidiIter>::match_context'
>> ../boost/xpressive/detail/core/state.hpp:33: error: changes meaning of
>> 'match_context' from 'struct
>> boost::xpressive::detail::match_context<BidiIter>'
>>
<snip>
>
> The bug also occurs on mainline GCC 4.3 (without my changes), so
> please report it to the Bugzilla system on gcc.gnu.org. Here's a
> shorter test case:
>
> template<typename Iter> struct match_context { };
>
> template<typename BidIter>
> struct match_state
> {
> typedef match_context<BidIter> match_context;
> };

Huh, they say it's not a bug.

------- Comment #1 from pinskia at gcc dot gnu dot org 2007-04-27 20:16
-------
No, the error message is correct. You change the meaning of
match_context in
the class.

Doing:
     typedef ::match_context<BidIter> match_context;

Fixes the source to be valid C++. Note C++ does not really require a
diagnostic here (it is one of the invalid code that C++ does not require
one).

----
Seems odd to me, but I don't have time to dig in the standard right now. 
GCC 4.3 is the only compiler that complains about this. Even Comeau 
accepts it.
-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk