Open Bug 1493051 Opened 6 years ago Updated 2 years ago

Temporary class errors are missing important context

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect

Tracking

(Not tracked)

REOPENED

People

(Reporter: glandium, Unassigned)

Details

I got this error on try with clang 7, bug 1479232 and bug 1492894. They are not false positives, but they also make it very hard to find the root cause: [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - In file included from /builds/worker/workspace/build/src/obj-firefox/media/webrtc/signaling/src/peerconnection/Unified_cpp_src_peerconnection0.cpp:2: [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - In file included from /builds/worker/workspace/build/src/media/webrtc/signaling/src/peerconnection/PacketDumper.cpp:7: [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/media/MediaUtils.h:219:31: error: variable of type 'LambdaType' (aka 'LambdaRunnable<std::_Bind<(lambda at /builds/worker/workspace/build/src/media/webrtc/signaling/src/peerconnection/PacketDumper.cpp:30:11) (already_AddRefed<mozilla::PeerConnectionImpl>)> >') is only valid as a temporary [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - RefPtr<LambdaType> lambda = new LambdaType(std::forward<OnRunType>(aOnRun)); [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/media/MediaUtils.h:219:31: note: value incorrectly allocated on the heap [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/media/MediaUtils.h:211:13: note: 'LambdaType' (aka 'LambdaRunnable<std::_Bind<(lambda at /builds/worker/workspace/build/src/media/webrtc/signaling/src/peerconnection/PacketDumper.cpp:30:11) (already_AddRefed<mozilla::PeerConnectionImpl>)> >') is a temporary type because member 'mOnRun' is a temporary type 'std::_Bind<(lambda at /builds/worker/workspace/build/src/media/webrtc/signaling/src/peerconnection/PacketDumper.cpp:30:11) (already_AddRefed<mozilla::PeerConnectionImpl>)>' [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - OnRunType mOnRun; [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../include/c++/4.9.4/functional:1256:29: note: 'std::_Bind<(lambda at /builds/worker/workspace/build/src/media/webrtc/signaling/src/peerconnection/PacketDumper.cpp:30:11) (already_AddRefed<mozilla::PeerConnectionImpl>)>' is a temporary type because member '_M_bound_args' is a temporary type 'tuple<already_AddRefed<mozilla::PeerConnectionImpl> >' [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - tuple<_Bound_args...> _M_bound_args; [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../include/c++/4.9.4/tuple:390:11: note: 'tuple<already_AddRefed<mozilla::PeerConnectionImpl> >' is a temporary type because it inherits from a temporary type '_Tuple_impl<0, already_AddRefed<mozilla::PeerConnectionImpl> >' [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - class tuple : public _Tuple_impl<0, _Elements...> [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../include/c++/4.9.4/tuple:231:12: note: '_Tuple_impl<0, already_AddRefed<mozilla::PeerConnectionImpl> >' is a temporary type because it inherits from a temporary type '_Head_base<0U, already_AddRefed<mozilla::PeerConnectionImpl>, __empty_not_final<already_AddRefed<PeerConnectionImpl> >::value>' [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - struct _Tuple_impl<_Idx, _Head, _Tail...> [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/clang/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../include/c++/4.9.4/tuple:174:13: note: '_Head_base<0U, already_AddRefed<mozilla::PeerConnectionImpl>, __empty_not_final<already_AddRefed<PeerConnectionImpl> >::value>' is a temporary type because member '_M_head_impl' is a temporary type 'already_AddRefed<mozilla::PeerConnectionImpl>' [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - _Head _M_head_impl; [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - In file included from /builds/worker/workspace/build/src/obj-firefox/media/webrtc/signaling/src/peerconnection/Unified_cpp_src_peerconnection0.cpp:11: [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - In file included from /builds/worker/workspace/build/src/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp:9: [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mtransport/runnable_utils.h:116:10: error: variable of type 'runnable_args_func<void (*)(const RefPtr<nsDOMDataChannel> &, const RefPtr<mozilla::dom::PeerConnectionObserver> &), typename mozilla::Decay<already_AddRefed<nsDOMDataChannel> >::Type, typename mozilla::Decay<RefPtr<PeerConnectionObserver> &>::Type>' (aka 'runnable_args_func<void (*)(const RefPtr<nsDOMDataChannel> &, const RefPtr<mozilla::dom::PeerConnectionObserver> &), already_AddRefed<nsDOMDataChannel>, RefPtr<mozilla::dom::PeerConnectionObserver> >') is only valid as a temporary [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - return new runnable_args_func<FunType, typename mozilla::Decay<Args>::Type...>(f, std::forward<Args>(args)...); [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.785Z] 23:34:58 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mtransport/runnable_utils.h:116:10: note: value incorrectly allocated on the heap [task 2018-09-20T23:34:58.786Z] 23:34:58 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mtransport/runnable_utils.h:109:18: note: 'runnable_args_func<void (*)(const RefPtr<nsDOMDataChannel> &, const RefPtr<mozilla::dom::PeerConnectionObserver> &), typename mozilla::Decay<already_AddRefed<nsDOMDataChannel> >::Type, typename mozilla::Decay<RefPtr<PeerConnectionObserver> &>::Type>' (aka 'runnable_args_func<void (*)(const RefPtr<nsDOMDataChannel> &, const RefPtr<mozilla::dom::PeerConnectionObserver> &), already_AddRefed<nsDOMDataChannel>, RefPtr<mozilla::dom::PeerConnectionObserver> >') is a temporary type because member 'mArgs' is a temporary type 'Tuple<already_AddRefed<nsDOMDataChannel>, RefPtr<mozilla::dom::PeerConnectionObserver> >' [task 2018-09-20T23:34:58.786Z] 23:34:58 INFO - Tuple<Args...> mArgs; [task 2018-09-20T23:34:58.787Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.787Z] 23:34:58 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/Tuple.h:293:7: note: 'Tuple<already_AddRefed<nsDOMDataChannel>, RefPtr<mozilla::dom::PeerConnectionObserver> >' is a temporary type because it inherits from a temporary type 'detail::TupleImpl<0, already_AddRefed<nsDOMDataChannel>, RefPtr<PeerConnectionObserver> >' [task 2018-09-20T23:34:58.787Z] 23:34:58 INFO - class Tuple<A, B> : public detail::TupleImpl<0, A, B> [task 2018-09-20T23:34:58.787Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.789Z] 23:34:58 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/Tuple.h:219:9: note: 'detail::TupleImpl<0, already_AddRefed<nsDOMDataChannel>, RefPtr<PeerConnectionObserver> >' is a temporary type because member 'mHead' is a temporary type 'already_AddRefed<nsDOMDataChannel>' [task 2018-09-20T23:34:58.789Z] 23:34:58 INFO - HeadT mHead; // The element stored at this index in the tuple. [task 2018-09-20T23:34:58.789Z] 23:34:58 INFO - ^ [task 2018-09-20T23:34:58.789Z] 23:34:58 INFO - 2 errors generated. The missing part is that those errors come from template instantiations at some other location (the first in PacketDumper::~PacketDumper and the other in PeerConnectionImpl::NotifyDataChannel)
Flags: needinfo?(bpostelnicu)

Are we interested in pursuing this?

Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(bpostelnicu) → needinfo?(mh+mozilla)
Resolution: --- → FIXED

I think we should, because warnings that are hard to act upon are not very helpful.

Also, if we ever want to go forward with things like bug 1443265, not having to manually figure out the root cause of those warnings is going to help.

Status: RESOLVED → REOPENED
Flags: needinfo?(mh+mozilla)
Resolution: FIXED → ---
Product: Firefox Build System → Developer Infrastructure
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.