> 1. '-Wdeprecated-copy'
> As specified in C++11 [1], "the generation of the implicitly-defined
> copy constructor is deprecated if T has a user-defined destructor or
> user-defined copy assignment operator". The rationale behind is the
> well-known Rule of Three [2].
> 
> Introduced since gcc-9 [3] and clang-10 [4], flag '-Wdeprecated-copy'
> warns about the C++11 deprecation of implicitly declared copy
> constructor and assignment operator if one of them is user-provided.
> Defining an explicit copy constructor would suppress this warning.
> 
> The main reason why debug build with gcc-9 or higher succeeds lies in
> the inconsistent warning behaviors between gcc and clang. See the
> reduced code example [5]. We suspect it might be return value
> optimization/copy elision [6] that drives gcc not to declare implicit
> copy constructor for this case.
> 
> Note that flag '-Wdeprecated' in clang-8 and clang-9 would also raise
> warnings for deprecated defintions of copy constructors. However,
> '-Wdeprecated' is not enabled by '-Wall' or '-Wextra'. Hence, clang-8
> and clang-9 are not affected.
> 
> ~~2. '-Wimplicit-int-float-conversion'~~
> ~~Making the conversion explicit would fix it.~~
> 
> ~~Flag '-Wimplicit-int-float-conversion' is first introduced in clang-10.~~
> ~~Therefore clang-8 and clang-9 are not affected. The flag with similar~~
> ~~functionality in gcc is '-Wfloat-conversion', but it is not enabled by~~
> ~~'-Wall' or '-Wextra'. That's why this warning does not apprear when~~
> ~~building with gcc.~~
> 
> [1] https://en.cppreference.com/w/cpp/language/copy_constructor
> [2] https://en.cppreference.com/w/cpp/language/rule_of_three
> [3] https://www.gnu.org/software/gcc/gcc-9/changes.html
> [4] https://releases.llvm.org/10.0.0/tools/clang/docs/ReleaseNotes.html
> [5] https://godbolt.org/z/err4jM
> [6] https://en.wikipedia.org/wiki/Copy_elision#Return_value_optimization
> 
> 
> Note that we have tested with this patch, debug build succeeded with clang-10 
> on Linux X86-64/AArch64 machines.
> Note that '--with-extra-cxxflags=-Wno-implicit-int-float-conversion' should 
> be added when configuration. It's another issue (See JDK-8259288)

Hao Sun has updated the pull request incrementally with one additional commit 
since the last revision:

  Define the copy assign operator of class DUIterator_Last as defaulted
  
  The copy assignment operator of class DUIterator_Last should also be
  defined as defaulted, i.e. =default, keeping consistent with the copy
  constructor.
  
  Besides, fix the NIT for the copy ctor definition of class
  DUIterator_Last.
  
  Change-Id: I2f9502f023443163910eea9469b72df5bf1e25e0
  CustomizedGitHooks: yes

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1874/files
  - new: https://git.openjdk.java.net/jdk/pull/1874/files/4cc18217..5c8195b5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1874&range=04
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1874&range=03-04

  Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1874.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1874/head:pull/1874

PR: https://git.openjdk.java.net/jdk/pull/1874

Reply via email to