Opened 11 years ago

Closed 11 years ago

#6016 closed Bugs (fixed)

Specializing tag_of is ambiguous with having a fusion tag

Reported by: Mathias Gaunard Owned by: Joel de Guzman
Milestone: To Be Determined Component: fusion
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

The way tag_of is implemented, having both a specialization of tag_of and a fusion_tag typedef is ambiguous.

This is problematic because it can prevent redefining Proto expressions as other types of fusion sequences for example.

testcase:

#include <boost/fusion/include/tag_of.hpp>

struct my_tag {};

template<class T>
struct my_type
{
    typedef my_tag fusion_tag;
};

namespace boost { namespace fusion { namespace traits
{
    template<class T>
    struct tag_of< my_type<T> >
    {
        typedef my_tag type;
    };
} } }

int main()
{
    boost::fusion::traits::tag_of<my_type<int> >::type _;
}

To solve this problem, a two-level specialization system should be provided so that specialization is preferred over SFINAE.

Change History (1)

comment:1 by Joel de Guzman, 11 years ago

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