[xsd-users] Compilation Error

Boris Kolpackov boris at codesynthesis.com
Thu Apr 27 11:55:29 EDT 2006


Hi Andrew,

Andrew Ward <andy.ward at hevday.com> writes:

>    <xsd:simpleType name="SideType">
>        <xsd:restriction base="xsd:token">
>            <xsd:enumeration value="top"/>
>            <xsd:enumeration value="left"/>
>            <xsd:enumeration value="bottom"/>
>            <xsd:enumeration value="right"/>
>        </xsd:restriction>
>    </xsd:simpleType>
>
>    <xsd:simpleType name="TopOrBottomType">
>        <xsd:restriction base="SideType">
>            <xsd:enumeration value="top"/>
>            <xsd:enumeration value="bottom"/>
>        </xsd:restriction>
>    </xsd:simpleType>
>
> ...
>
> s.cpp
> s.cpp(852) : error C2450: switch expression of type 'TopOrBottomType' is
> illegal
>        Ambiguous user-defined-conversion

That's a bug in the new enum mapping which was introduced in 2.1.0. Both
TopOrBottomType and SideType define implicit conversion operators to
underlying enum types. But since TopOrBottomType inherits SideType, there
is ambiguity when trying to convert from TopOrBottomType. This will be
fixed in 2.1.1, which should hopefully be out by Tue. For the meantime
I have two workarounds for you:

1. Temporarily change your schema to not inherit one enum from the other.

2. Downgrade to 2.0.0.

Thanks for reporting this!

-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20060427/44494ca8/attachment.pgp


More information about the xsd-users mailing list