BIND 10 #903: 'this' : used in base member initializer list

BIND 10 Development do-not-reply at isc.org
Wed May 4 22:08:18 UTC 2011


#903: 'this' : used in base member initializer list
-------------------------------------+-------------------------------------
                   Reporter:         |                  Type:  defect
  fdupont                            |              Priority:  minor
                     Status:  new    |             Component:  Unclassified
                  Milestone:  New    |             Sensitive:  0
  Tasks                              |           Sub-Project:  DNS
                   Keywords:         |  Estimated Difficulty:  0
            Defect Severity:         |           Total Hours:  0
  Medium                             |
Feature Depending on Ticket:         |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
 MSVC raises some C4355 "'this' : used in base member initializer list"
 warnings on declarations like (from src/lib/asiodns/dns_server.h):

 class DNSServer {
 protected:
     !///
     !/// \name Constructors and destructors
     !///
     !/// This is intentionally defined as \c protected, as this base class
     !/// should never be instantiated except as part of a derived class.
     !//@{
     DNSServer() : self_(this) {}

 Unfortunately MSVC is right: this construct doesn't work. It doesn't
 really matter when the faulty is never used but it is still incorrect so
 should be fixed...
 I propose to use this only in the body where it is valid, i.e.,
     DNSServer() { self_ = this; }

-- 
Ticket URL: <https://bind10.isc.org/ticket/903>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list