https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83085
Bug ID: 83085 Summary: Suspicious type qualifiers ignored on cast result type [-Werror=ignored-qualifiers] Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: andi at mozilla dot com Target Milestone: --- I'm using this debian snapshop,https://tracker.debian.org/pkg/gcc-8, of gcc8 in order to build mozilla firefox, and I encountered this potential issue when building with -Werror=ignored-qualifiers. >> 2:46.84 In file included from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Result.h:17:0, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/Result.h:119, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/jspubtd.h:22, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/nsCycleCollectionTraversalCallback.h:10, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/nsCycleCollectionNoteChild.h:13, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:33, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/nsAutoPtr.h:10, >> 2:46.84 from >> /root/firefox-gcc-last/ipc/chromium/src/chrome/common/ipc_message.h:21, >> 2:46.84 from >> /root/firefox-gcc-last/ipc/chromium/src/chrome/common/ipc_message_utils.h:22, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/ipc/IPCMessageUtils.h:11, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders/mozilla/ipc/IPCStream.h:11, >> 2:46.84 from >> /root/firefox-gcc-last/ipc/glue/IPCStreamUtils.h:10, >> 2:46.84 from >> /root/firefox-gcc-last/ipc/glue/IPCStreamUtils.cpp:7, >> 2:46.84 from >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/ipc/glue/Unified_cpp_ipc_glue1.cpp:2: >> 2:46.84 >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Variant.h: >> In instantiation of 'typename mozilla::detail::Nth<N, Ts ...>::Type >> mozilla::Variant<Ts>::extract() [with long unsigned int N = 0; Ts = {const >> int, const char*, void (*)(nsITimer*, bool, void*, char*, long unsigned >> int)}; typename mozilla::detail::Nth<N, Ts ...>::Type = const int]': >> 2:46.84 >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Variant.h:219:7: >> required from 'static void mozilla::detail::VariantImplementation<Tag, N, >> T, Ts ...>::moveConstruct(void*, Variant&&) [with Variant = >> mozilla::Variant<const int, const char*, void (*)(nsITimer*, bool, void*, >> char*, long unsigned int)>; Tag = unsigned char; long unsigned int N = 0; T >> = const int; Ts = {const char*, void (*)(nsITimer*, bool, void*, char*, long >> unsigned int)}]' >> 2:46.84 >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Variant.h:588:24: >> required from 'mozilla::Variant<Ts>::Variant(mozilla::Variant<Ts>&&) >> [with Ts = {const int, const char*, void (*)(nsITimer*, bool, void*, char*, >> long unsigned int)}]' >> 2:46.84 /usr/include/c++/8/bits/move.h:193:11: required from 'typename >> std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, >> std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >> >::value>::type std::swap(_Tp&, _Tp&) [with _Tp = mozilla::Variant<const >> int, const char*, void (*)(nsITimer*, bool, void*, char*, long unsigned >> int)>; typename >> std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<_Tp> >, >> std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >> >::value>::type = void]' >> 2:46.84 /root/firefox-gcc-last/xpcom/threads/nsTimerImpl.h:98:35: required >> from here >> 2:46.84 >> /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Variant.h:714:44: >> error: type qualifiers ignored on cast result type >> [-Werror=ignored-qualifiers] >> 2:46.84 return typename detail::Nth<N, Ts...>::Type(Move(as<N>())); >> 2:46.84 Looking at the code the issue is reported here: https://dxr.mozilla.org/mozilla-central/source/mfbt/Variant.h?q=return+typename+detail%3A%3ANth%3CN%2C+Ts...%3E%3A%3AType%28Move%28as%3CN%3E%28%29%29%29%3B&redirect_type=single#709 That gets called from here: https://dxr.mozilla.org/mozilla-central/source/xpcom/threads/nsTimerImpl.h?q=nsTimerImpl.h&redirect_type=direct#98 I personally believe that in this context the warning just adds noise since nothing dangerous nor standard compliant happens.