Skip to content

Commit fab5676

Browse files
author
Harold Seigel
committed
8247869: Change NONCOPYABLE to delete the operations
Reviewed-by: kbarrett, dholmes
1 parent c0542ed commit fab5676

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/hotspot/share/utilities/globalDefinitions.hpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -73,18 +73,12 @@
7373
// This file holds all globally used constants & types, class (forward)
7474
// declarations and a few frequently used utility functions.
7575

76-
// Declare the named class to be noncopyable. This macro must be used in
77-
// a private part of the class's definition, followed by a semi-colon.
78-
// Doing so provides private declarations for the class's copy constructor
79-
// and assignment operator. Because these operations are private, most
80-
// potential callers will fail to compile because they are inaccessible.
81-
// The operations intentionally lack a definition, to provoke link-time
82-
// failures for calls from contexts where they are accessible, e.g. from
83-
// within the class or from a friend of the class.
84-
// Note: The lack of definitions is still not completely bullet-proof, as
85-
// an apparent call might be optimized away by copy elision.
86-
// For C++11 the declarations should be changed to deleted definitions.
87-
#define NONCOPYABLE(C) C(C const&); C& operator=(C const&) /* next token must be ; */
76+
// Declare the named class to be noncopyable. This macro must be followed by
77+
// a semi-colon. The macro provides deleted declarations for the class's copy
78+
// constructor and assignment operator. Because these operations are deleted,
79+
// they cannot be defined and potential callers will fail to compile.
80+
#define NONCOPYABLE(C) C(C const&) = delete; C& operator=(C const&) = delete /* next token must be ; */
81+
8882

8983
//----------------------------------------------------------------------------------------------------
9084
// Printf-style formatters for fixed- and variable-width types as pointers and

0 commit comments

Comments
 (0)