Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2006-03-23 04:00:51


Bugs item #1456780, was opened at 2006-03-23 01:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1456780&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: ambiguous overloads in boost::variant source code

Initial Comment:
I cannot figure out, why the following little program
does not compile. It simply typedefs a variant of a
specific bounded type set and then derives a class from
this type. I've tried to compile it with VC 2005. It
does not compile because of ambiguous overloads within
the boost::variant source.

It would be very helpful if somebody could shed light
on the issue.

Best regards
Peter

PS: I intended to post this to the boost developers
list, but I was unable to log onto the list today.

*************************************************************

#include <boost/variant.hpp>

typedef boost::variant<char, int, double>
numeric_type_variant;

class numeric_type
        : public numeric_type_variant
{
public:
        /// Default constructor.
        numeric_type() : numeric_type_variant() { }

        template <typename T>
        /// Converting constructor.
        numeric_type(T const& t) : numeric_type_variant(t) { }

        // some more code
};

int main(int argc, char* argv[])
{
        char ba;
        int bb;
        double bc;

        numeric_type a;
        numeric_type b(ba);
        numeric_type c(bb);
        numeric_type d(bc);

        a = ba;
        a = bb;
        a = bc;

        return 0;
}

*************************************************************

This is the build log:

------ Build started: Project: test_variant,
Configuration: Debug Win32 ------ Compiling...
test_variant.cpp
c:\_ngi\toolkits\boost_1_33_1\boost\variant\variant.hpp(1342)
: error C2666:
'boost::variant<T0_,T1,T2>::convert_construct' : 2
overloads have similar conversions
        with
        [
            T0_=char,
            T1=int,
            T2=double
        ]
       
c:\_ngi\toolkits\boost_1_33_1\boost\variant\variant.hpp(1327):
could be 'void
boost::variant<T0_,T1,T2>::convert_construct<char,int,double,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_>(const
boost::variant<T0_,T1,T2> &,long)'
        with
        [
            T0_=char,
            T1=int,
            T2=double
        ]
       
c:\_ngi\toolkits\boost_1_33_1\boost\variant\variant.hpp(1258):
or 'void
boost::variant<T0_,T1,T2>::convert_construct<const T>(T
&,int,boost::mpl::false_)'
        with
        [
            T0_=char,
            T1=int,
            T2=double,
            T=numeric_type
        ]
        while trying to match the argument list '(const
numeric_type, long)'
       
c:\_ngi\toolkits\boost_1_33_1\boost\variant\variant.hpp(1580)
: see reference to function template instantiation
'boost::variant<T0_,T1,T2>::variant<T>(const T &)'
being compiled
        with
        [
            T0_=char,
            T1=int,
            T2=double,
            T=numeric_type
        ]
       
c:\_ngi\toolkits\boost_1_33_1\boost\variant\variant.hpp(1590)
: see reference to function template instantiation
'void boost::variant<T0_,T1,T2>::assign<T>(const T &)'
being compiled
        with
        [
            T0_=char,
            T1=int,
            T2=double,
            T=numeric_type
        ]
       
c:\_schrott\test_variant\test_variant\test_variant.cpp(36)
: see reference to function template instantiation
'boost::variant<T0_,T1,T2>
&boost::variant<T0_,T1,T2>::operator
=<numeric_type>(const T &)' being compiled
        with
        [
            T0_=char,
            T1=int,
            T2=double,
            T=numeric_type
        ]
Build log was saved at
"file://c:\_schrott\test_variant\test_variant\Debug\BuildLog.htm"
test_variant - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date,
0 skipped ==========

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1456780&group_id=7586

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


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