Opened 12 years ago

Closed 12 years ago

#4676 closed Patches (fixed)

Ambiguous register_type with polymorphic_x_?archive on g++

Reported by: Richard Hazlewood Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.44.0 Severity: Problem
Keywords: gcc g++ ambiguous polymorphic archive Cc:

Description

Using the register_type<> mechanism with a polymorphic archive causes ambiguity errors on g++.

Example and patch attached (for detail/polymorphic_?archive_route.hpp).

Attachments (2)

register_type_ambig.cpp (633 bytes ) - added by boost@… 12 years ago.
g++ register_type ambiguity
register_type.patch (746 bytes ) - added by boost@… 12 years ago.
g++ register_type ambiguity patch

Download all attachments as: .zip

Change History (7)

by boost@…, 12 years ago

Attachment: register_type_ambig.cpp added

g++ register_type ambiguity

by boost@…, 12 years ago

Attachment: register_type.patch added

g++ register_type ambiguity patch

comment:1 by Richard Hazlewood, 12 years ago

Note: this was with g++ 4.4

comment:2 by Robert Ramey, 12 years ago

no way can I put a "using" declaration in a *.hpp file.

What we can do is add the following to polymorphic_oarchive:

    // register type function
    const basic_pointer_iserializer * 
    register_type(T * t = NULL){
        return ArchiveImplementation::register_type(t);
    }

and similar block to polymorphic_oarchive. Would that not solve the issue. I've included this in my code base for eventual migration to trunk and release but don't have a specific test yet. Care to try this?

Robert Ramey

comment:3 by Richard Hazlewood <boost@…>, 12 years ago

The "using" is a convenience (std: 7.3.3) to bring one of the routes to register_type<> into scope of the polymorphic_?archive_route classes. However, if you are concerned that a compiler may not support it, a routing register_type<>, as you specify, achieves the same ends - it matters not to me.

However, I suspect it will have to go at the same place as the using patch; i.e. in the archive::detail::polymorphic_?archive_route classes. It is at this point in the hierarchy that the two ambiguous routes to register_type<> (interface_?archive) occur; taking polymorphic_binary_oarchive as an example:

polymorphic_binary_oarchive:

      polymorphic_oarchive_route<>
                   |
   ----------------------------------------
   |                                      |
polymorphic_oarchive           (ArchiveImplementation)
   |                           binary_oarchive_impl<naked_binary_oarchive>
interface_oarchive<poly_oa>               |
                               basic_binary_oarchive<naked_binary_oarchive>
                                          |
                               common_oarchive<naked_binary_oarchive>
                                          |
                               -----------------------------
                               |                           |
                         basic_oarchive   interface_oarchive<naked_binary_oarchive>

I'm happy to test anything you have; is it on a branch in the SVN repository?

comment:4 by Robert Ramey, 12 years ago

I have fixed this, test it, and checked it into the trunk.

Robert Ramey

comment:5 by Robert Ramey, 12 years ago

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