1>V:\Trunk\stable\src\Include\Tools/unique_RAII.h(61): error C2248: 'boost::noncopyable_::noncopyable::operator =' : cannot access private member declared in class 'boost::noncopyable_::noncopyable' .... This diagnostic occurred in the compiler generated function (the normal copy constructor) That kind of defeats the purpose, doesn't it? I have to declare a dummy copy constructor to get the class to compile.
On Tue, Mar 20, 2012 at 4:44 AM, John M. Dlugosz
1>V:\Trunk\stable\src\Include\**Tools/unique_RAII.h(61): error C2248: 'boost::noncopyable_::**noncopyable::operator =' : cannot access private member declared in class 'boost::noncopyable_::**noncopyable' .... This diagnostic occurred in the compiler generated function (the normal copy constructor)
That kind of defeats the purpose, doesn't it? I have to declare a dummy copy constructor to get the class to compile.
If I haven't missed the point of your post I think that's exactly what it's supposed to do. The mention of 'noncopyable' in the error message is the hint. HTH - Rob.
On 3/20/2012 3:21 AM, Robert Jones wrote:
That kind of defeats the purpose, doesn't it? I have to declare a dummy copy constructor to get the class to compile.
If I haven't missed the point of your post I think that's exactly what it's supposed to do. The mention of 'noncopyable' in the error message is the hint.
I interpreted the error, which cited the class itself and not anything in my code that uses the class, to mean that the auto-generation was not suppressed at all and in fact prevented it from being successful rather than silently being not generated. It turns out that something in my code did want the assignment, so the class "did its job" but was totally unhelpful in telling me where in the code this was.
I interpreted the error, which cited the class itself and not anything in my code that uses the class, to mean that the auto-generation was not suppressed at all and in fact prevented it from being successful rather than silently being not generated.
It turns out that something in my code did want the assignment, so the class "did its job" but was totally unhelpful in telling me where in the code this was.
To get more helpful error, declare a private copy-ctor & assignment operator in your class - and you'll see who attempts to copy.
Date: Wed, 21 Mar 2012 09:18:30 +0200
I interpreted the error, which cited the class itself and not anything in my code that uses the class, to mean that the auto-generation was not suppressed at all and in fact prevented it from being successful rather than silently being not generated.
It turns out that something in my code did want the assignment, so the class "did its job" but was totally unhelpful in telling me where in the code this was.
To get more helpful error, declare a private copy-ctor & assignment operator in your class - and you'll see who attempts to copy.
I wonder if we should add an extra inheritance layer. We would make a new noncopyable_inner class with the disabling code, then have the current noncopyable inherit from the new class. Daryle W.
It turns out that something in my code did want the assignment, so the class "did its job" but was totally unhelpful in telling me where in the code this was.
To get more helpful error, declare a private copy-ctor & assignment operator in your class - and you'll see who attempts to copy.
I wonder if we should add an extra inheritance layer. We would make a new noncopyable_inner class with the disabling code, then have the current noncopyable inherit from the new class.
I'm afraid, that won't help. This is a known MSVC issue, which they don't want to fix: http://connect.microsoft.com/VisualStudio/feedback/details/99186/diagnostic-...
On 3/21/2012 9:35 AM, Igor R wrote:
I'm afraid, that won't help. This is a known MSVC issue, which they don't want to fix: http://connect.microsoft.com/VisualStudio/feedback/details/99186/diagnostic-...
I suppose we'll have =delete in a year or so.
On 3/21/2012 2:18 AM, Igor R wrote:
To get more helpful error, declare a private copy-ctor& assignment operator in your class - and you'll see who attempts to copy.
That's what I did. So is there anything that boost::noncopyable does for me beyond that, or did I just make it totally redundant? —John
On Sat, Mar 24, 2012 at 11:01:30AM -0500, John M. Dlugosz wrote:
On 3/21/2012 2:18 AM, Igor R wrote:
To get more helpful error, declare a private copy-ctor& assignment operator in your class - and you'll see who attempts to copy.
That's what I did. So is there anything that boost::noncopyable does for me beyond that, or did I just make it totally redundant?
The downside of the private declare-and-not-implement is that if the copy attempt is in a member function or friend, the error does not surface until linking time, where all the context of use is completely obliterated. -- Lars Viklund | zao@acc.umu.se
participants (5)
-
Daryle Walker
-
Igor R
-
John M. Dlugosz
-
Lars Viklund
-
Robert Jones