Chris Peterson cdcbafc835 Bug 1776347 - ipc/chromium: Replace some DISALLOW_COPY_AND_ASSIGN macros with explicitly deleted constructors to fix C++20 build errors. r=ipc-reviewers,nika
gcc -std=c++20 (but not clang -std=c++20) complains about template class definitions that specify the template parameter on the class constructor. For example:

template <typename T>
class C {
  C(int x) {}
  // OK in clang and gcc for both -std=c++17 and -std=c++20.

  C<T>(int x, int y) {}
  // OK in clang for both -std=c++17 and -std=c++20.
  // OK in gcc -std=c++17 but a build error with -std=c++20.
};

The ipc/chromium build error because the `DISALLOW_COPY_AND_ASSIGN` macro expands to such a template class definition:

ipc/chromium/src/base/basictypes.h:53:12: error: expected unqualified-id before 'const'
      |   TypeName(const TypeName&) = delete
      |            ^~~~~
ipc/chromium/src/base/threading/thread_local.h:95:3: note: in expansion of macro 'DISALLOW_COPY_AND_ASSIGN'
      |   DISALLOW_COPY_AND_ASSIGN(ThreadLocalPointer<T>);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~

Google replaced chromium/base's DISALLOW_COPY_AND_ASSIGN macros with explicitly deleted constructors, so let's apply their upstream fix:

7319bbdb7d

Differential Revision: https://phabricator.services.mozilla.com/D150216
2022-06-28 04:17:30 +00:00
..