I saw error during jpackage compilation with VS 2019 (16.9.0) as following (on
Japanese locale):
c:\progra~2\micros~2\2019\commun~1\vc\tools\msvc\1428~1.299\include\utility(604):
error C2440: '=': '_Other' から '_Ty' に変換できません。
with
[
_Other=nullptr
]
and
[
_Ty=unsigned long
]
c:\progra~2\micros~2\2019\commun~1\vc\tools\msvc\1428~1.299\include\utility(604):
note: ネイティブの nullptr はブールに変換するか、または reinterpret_cast を使用して整数型に変換することのみが可能です
c:\progra~2\micros~2\2019\commun~1\vc\tools\msvc\1428~1.299\include\memory(3423):
note: コンパイル対象の関数 テンプレート インスタンス化 '_Ty std::exchange<_Ty2,nullptr>(_Ty &,_Other
&&) noexcept(false)' のリファレンスを確認してください
with
[
_Ty=unsigned long,
_Ty2=unsigned long,
_Other=nullptr
]
c:\progra~2\micros~2\2019\commun~1\vc\tools\msvc\1428~1.299\include\memory(3422):
note: クラス テンプ レート メンバー関数 'unsigned long
std::unique_ptr<MSIHANDLE,msi::MsiHandleDeleter>::release(void) noexcept'
のコンパイル中
d:\github-forked\jdk\src\jdk.jpackage\windows\native\common\MsiDb.cpp(237):
note: コンパイル対象の関数 テンプレート インスタンス化 'unsigned long
std::unique_ptr<MSIHANDLE,msi::MsiHandleDeleter>::release(void) noexcept'
のリファレンスを確認してください
d:\github-forked\jdk\src\jdk.jpackage\windows\native\common\MsiDb.h(119): note:
コンパイル対象の クラ ス テンプレート インスタンス化 'std::unique_ptr<MSIHANDLE,msi::MsiHandleDeleter>'
のリファレンスを確認してください
`UniqueMSIHANDLE` is declared in MsiUtils.h as `unique_ptr` for `MSIHANDLE`.
`MSIHANDLE` seems to be declared as synonym for `unsigned long`, not a pointer
type.
I think `MSIHANDLE` does not need to handle as `unique_ptr` if it releases at
d'tor of the class which holds it (`Database`, `DatabaseRecord`).
-------------
Commit messages:
- 8263135: unique_ptr should not be used for types that are not pointers
Changes: https://git.openjdk.java.net/jdk/pull/2858/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2858&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8263135
Stats: 77 lines in 4 files changed: 14 ins; 36 del; 27 mod
Patch: https://git.openjdk.java.net/jdk/pull/2858.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2858/head:pull/2858
PR: https://git.openjdk.java.net/jdk/pull/2858