Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-920

Lack of copy ctor definition in XMemory prevents build on VC++ 7.0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • Utilities
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 20642

    Description

      In XMemory.hpp two constructors (copy and assignment) have been marked as private/unimplemented:

      // -----------------------------------------------------------------------
      // Unimplemented constructors and operators
      // -----------------------------------------------------------------------
      XMemory(const XMemory&);
      XMemory& operator=(const XMemory&);

      No definition can be found in the corresponding CPP file. Most compilers will (and should) probably not care, since these constructors will never be used. Nevertheless, the lack of a definition causes VC++ 7.0 to emit a linker error when its Whole Program Optimization feature, WPO, is enabled (and I want to use WPO to achieve optimal performance).

      The error can be resolved by providing a dummy inline definition in the header file (or perhaps in the implementation file), like this:

      XMemory(const XMemory&)

      { /* Not implemented */ }

      XMemory& operator=(const XMemory&)

      { /* Not implemented */ return *this; }

      You might want to add an "assert(false);" in both methods in order to make sure any accidental use will not go undetected.

      Cheers!

      Attachments

        Activity

          People

            Unassigned Unassigned
            carbe771@student.liu.se C-J Berg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: