BIND 10 #858: silent MSVC warnings on libdns++

BIND 10 Development do-not-reply at isc.org
Thu Apr 21 08:44:06 UTC 2011


#858: silent MSVC warnings on libdns++
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:
  fdupont                            |                Status:  new
                       Type:         |             Milestone:  New Tasks
  enhancement                        |            Resolution:
                   Priority:  minor  |             Sensitive:  0
                  Component:         |           Sub-Project:  DNS
  Unclassified                       |  Estimated Difficulty:  0
                   Keywords:         |           Total Hours:  0
            Defect Severity:  Low    |
Feature Depending on Ticket:         |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------

Comment (by fdupont):

 The exact MSVC issue is:

 Compiler Warning (level 4) C4512

 'class' : assignment operator could not be generated

 The compiler cannot generate an assignment operator for the given class.
 No assignment operator was created.

 An assignment operator for the base class that is not accessible by the
 derived class can cause this warning.

 To avoid this warning, specify a user-defined assignment operator for the
 class.

 The compiler will also generate an assignment operator function for a
 class that does not define one. This assignment operator is a memberwise
 copy of the data members of an object. Because const data items cannot be
 modified after initialization, if the class contains a const item, the
 default assignment operator would not work. Another cause of the C4512
 warning is a declaration of a nonstatic data member of reference type.

 You can resolve the C4512 warning for your code in one of three ways:

     * Explicitly define an assignment operator for the class.
     * Remove const or the reference operator from the data item in the
 class.
     * Use the #pragma warning statement to suppress the warning.

 => I suggest the first one, BTW boost has many such definitions to avoid
 this particular warning.

-- 
Ticket URL: <http://bind10.isc.org/ticket/858#comment:1>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list