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)
Change History (7)
by , 12 years ago
| Attachment: | register_type_ambig.cpp added | 
|---|
comment:2 by , 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 , 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:5 by , 12 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 


g++ register_type ambiguity