Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#903 closed defect (fixed)

'this' : used in base member initializer list

Reported by: fdupont Owned by: stephen
Priority: low Milestone: Sprint-20111220
Component: Unclassified Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: Medium
Sub-Project: DNS Feature Depending on Ticket: none
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

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; }

Subtickets

Change History (8)

comment:1 Changed 9 years ago by shane

  • Milestone changed from New Tasks to Year 3 Task Backlog

comment:2 Changed 8 years ago by jelte

  • Milestone changed from Year 3 Task Backlog to Next-Sprint-Proposed

comment:3 Changed 8 years ago by jelte

  • Estimated Difficulty changed from 0.0 to 2

comment:4 Changed 8 years ago by jelte

  • Milestone changed from Next-Sprint-Proposed to Sprint-20111220

comment:5 Changed 8 years ago by shane

  • Feature Depending on Ticket set to none

comment:6 Changed 8 years ago by stephen

  • Owner set to stephen
  • Status changed from new to assigned

Being tackled as part of #1470.

comment:7 Changed 8 years ago by stephen

  • Resolution set to fixed
  • Status changed from assigned to closed

Fix included in master in commit ee21a81dbcfc6dc3587a9ca8ae95175c3b52bfea (as a result of work done in the branch for #1470).

comment:8 Changed 8 years ago by jelte

  • Estimated Difficulty changed from 2 to 0
Note: See TracTickets for help on using tickets.