Modify

Opened 6 years ago

Closed 16 months ago

#6648 closed Bugs (fixed)

managed_unique_ptr cannot be used inside template (VS2008).

Reported by: anonymous Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

There is a very simple example:

#include <iostream>

#include <boost/interprocess/managed_windows_shared_memory.hpp>

#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/list.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/interprocess/sync/named_condition.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>

struct Request
{
 int a;
};

template<typename Segment, typename T>
class Channel
{
public:

 /// Value pointer in queue.
 typedef typename boost::interprocess::managed_unique_ptr<T, Segment>::type
  ValuePtr;

};

int main(int argc, char* argv[])
{
 Channel<boost::interprocess::managed_windows_shared_memory, Request>::ValuePtr v;
 
 std::cout << "Test" << std::endl;
 
 return 0;
}

I got this error in Visual Studio 2008:

T.cpp
C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) : error C2039: 'remove_reference' : is not a member of 'boost::interprocess::ipcdetail::ipcdetail'
        C:\Program Files\boost\boost_1_49_0\boost/interprocess/smart_ptr/unique_ptr.hpp(94) : see reference to class template instantiation 'boost::interprocess::ipcdetail::pointer_type<T,D>' being compiled
        with
        [
            T=Request,
            D=boost::interprocess::deleter<Request,boost::interprocess::segment_manager<char,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>,boost::interprocess::iset_index>>
        ]
        T.cpp(34) : see reference to class template instantiation 'boost::interprocess::unique_ptr<T,D>' being compiled
        with
        [
            T=Request,
            D=boost::interprocess::deleter<Request,boost::interprocess::segment_manager<char,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>,boost::interprocess::iset_index>>
        ]
C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) : error C2947: expecting '>' to terminate template-argument-list, found '<'
C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) : error C3203: 'remove_reference' : unspecialized class template can't be used as a template argument for template parameter 'D', expected a real type
C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) : error C2955: 'boost::interprocess::ipcdetail::remove_reference' : use of class template requires template argument list
        C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/type_traits.hpp(30) : see declaration of 'boost::interprocess::ipcdetail::remove_reference'
C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) : error C2143: syntax error : missing ';' before '>'
C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) : error C2039: 'type' : is not a member of '`global namespace''
C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) : error C2039: 'type' : is not a member of '`global namespace''
C:\Program Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) : error C2238: unexpected token(s) preceding ';'
C:\Program Files\boost\boost_1_49_0\boost/interprocess/smart_ptr/unique_ptr.hpp(94) : error C2039: 'type' : is not a member of 'boost::interprocess::ipcdetail::pointer_type<T,D>'
................

This example works fine in boost 1.48.0

Attachments (0)

Change History (1)

comment:1 Changed 16 months ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

This error can't be reproduced in the latest (1.61) version so closed as fixed.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.