Skip to content

GCC 6: Missing sized deallocation functions #957

@offa

Description

@offa

Compiling with GCC 6 (Cmake, C++11 enabled) emits following warning:

[…]/cpputest/src/CppUTest/MemoryLeakWarningPlugin.cpp:312:6: Warnung: the program should also define »void operator delete(void*, std::size_t)« [-Wsized-deallocation]
 void operator delete(void* mem) UT_NOTHROW
      ^~~~~~~~
[…]/cpputest/src/CppUTest/MemoryLeakWarningPlugin.cpp:332:6: Warnung: the program should also define »void operator delete [](void*, std::size_t)« [-Wsized-deallocation]
 void operator delete[](void* mem) UT_NOTHROW
      ^~~~~~~~

About this warning:

-Wsized-deallocation (C++ and Objective-C++ only)
Warn about a definition of an unsized deallocation function

          void operator delete (void *) noexcept;
          void operator delete[] (void *) noexcept;

without a definition of the corresponding sized deallocation function

          void operator delete (void *, std::size_t) noexcept;
          void operator delete[] (void *, std::size_t) noexcept;

or vice versa. Enabled by -Wextra along with -fsized-deallocation. 

Update: Same with C++11 disabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions