WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
234504
[Win] MSVC reports "DownloadBundleWin.cpp(87): error C2362: initialization of 'magic' is skipped by 'goto exit'" with /std:c++20
https://bugs.webkit.org/show_bug.cgi?id=234504
Summary
[Win] MSVC reports "DownloadBundleWin.cpp(87): error C2362: initialization of...
Fujii Hironori
Reported
2021-12-19 22:22:22 PST
[Win] MSVC reports "DownloadBundleWin.cpp(87): error C2362: initialization of 'magic' is skipped by 'goto exit'" with /std:c++20
> Source\WebCore\platform\network\win\DownloadBundleWin.cpp(87): error C2362: initialization of 'magic' is skipped by 'goto exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(80): note: see declaration of 'magic' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(87): note: see declaration of 'exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): error C2362: initialization of 'footerStartPosition' is skipped by 'goto exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(150): note: see declaration of 'footerStartPosition' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): note: see declaration of 'exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): error C2362: initialization of 'footerLength' is skipped by 'goto exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(143): note: see declaration of 'footerLength' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): note: see declaration of 'exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): error C2362: initialization of 'footerLengthPosition' is skipped by 'goto exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(135): note: see declaration of 'footerLengthPosition' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): note: see declaration of 'exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): error C2362: initialization of 'footerMagicNumber' is skipped by 'goto exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(122): note: see declaration of 'footerMagicNumber' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): note: see declaration of 'exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): error C2362: initialization of 'footerMagicNumberPosition' is skipped by 'goto exit' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(115): note: see declaration of 'footerMagicNumberPosition' > Source\WebCore\platform\network\win\DownloadBundleWin.cpp(173): note: see declaration of 'exit'
Attachments
Patch
(6.98 KB, patch)
2021-12-19 22:25 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(7.02 KB, patch)
2021-12-20 12:50 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(7.16 KB, patch)
2021-12-20 12:57 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(2.49 KB, patch)
2021-12-21 16:57 PST
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Fujii Hironori
Comment 1
2021-12-19 22:25:12 PST
Created
attachment 447584
[details]
Patch
Fujii Hironori
Comment 2
2021-12-20 12:50:37 PST
Created
attachment 447624
[details]
Patch
Fujii Hironori
Comment 3
2021-12-20 12:57:48 PST
Created
attachment 447626
[details]
Patch
EWS
Comment 4
2021-12-20 23:20:54 PST
Committed
r287299
(
245451@main
): <
https://commits.webkit.org/245451@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 447626
[details]
.
Radar WebKit Bug Importer
Comment 5
2021-12-20 23:21:16 PST
<
rdar://problem/86755997
>
Darin Adler
Comment 6
2021-12-21 01:07:27 PST
Comment on
attachment 447626
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447626&action=review
> Source/WebCore/platform/network/win/DownloadBundleWin.cpp:47 > +};
There should not be a semicolon here.
> Source/WebCore/platform/network/win/DownloadBundleWin.cpp:72 > + std::unique_ptr<FILE, decltype(&fileCloser)> bundle(bundlePtr, &fileCloser);
Should be able to just write std::unique_ptr with no template arguments and rely on the deduction guide to deduce the argument types.
> Source/WebCore/platform/network/win/DownloadBundleWin.cpp:107 > + std::unique_ptr<FILE, decltype(&fileCloser)> bundle(bundlePtr, &fileCloser);
Ditto.
Fujii Hironori
Comment 7
2021-12-21 12:06:33 PST
reopened.
Fujii Hironori
Comment 8
2021-12-21 14:05:04 PST
Comment on
attachment 447626
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447626&action=review
>> Source/WebCore/platform/network/win/DownloadBundleWin.cpp:72 >> + std::unique_ptr<FILE, decltype(&fileCloser)> bundle(bundlePtr, &fileCloser); > > Should be able to just write std::unique_ptr with no template arguments and rely on the deduction guide to deduce the argument types.
std::unique_ptr doesn't have the deduction guide. c++ - Why does std::unique_ptr not permit type inference? - Stack Overflow
https://stackoverflow.com/q/41162868
c++ - Why can't unique_ptr's template arguments be deduced? - Stack Overflow
https://stackoverflow.com/q/51109767
And, I want to specify a deleter in this case. And, C++17 lambda type doesn't have the default constructor. C++20 can compile the following code.
> std::unique_ptr<FILE, decltype(&fileCloser)> bundle(bundlePtr);
Darin Adler
Comment 9
2021-12-21 14:38:33 PST
(In reply to Fujii Hironori from
comment #8
)
> std::unique_ptr doesn't have the deduction guide.
I understand why it can’t have one without a deleter; too bad it can’t have one with a deleter. Glad you investigated.
Fujii Hironori
Comment 10
2021-12-21 16:57:03 PST
Created
attachment 447765
[details]
Patch
EWS
Comment 11
2021-12-24 13:40:58 PST
Committed
r287432
(
245567@main
): <
https://commits.webkit.org/245567@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 447765
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug