ipc/chromium: Replace some DISALLOW_COPY_AND_ASSIGN macros with explicitly deleted constructors to fix C++20 build errors
Categories
(Core :: IPC, task, P3)
Tracking
()
People
(Reporter: cpeterson, Assigned: cpeterson)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
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.
};
ipc/chromium build error when compiled as C++20 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:
https://chromium.googlesource.com/chromium/src/+/7319bbdb7d6ea97ef3237381e4a88b7a465dd0da
Assignee | ||
Comment 1•2 years ago
|
||
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:
https://chromium.googlesource.com/chromium/src/+/7319bbdb7d6ea97ef3237381e4a88b7a465dd0da
Pushed by cpeterson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2a36fee6180d ipc/chromium: Replace some DISALLOW_COPY_AND_ASSIGN macros with explicitly deleted constructors to fix C++20 build errors. r=ipc-reviewers,nika
Description
•