You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code is pretty legit and the compiler should be able to figure our the proper variable to use to initialize the member.
Also the -Werror=shadow is also a valid option, though it can introduce warning on the code, though it should not be error.
To fix it, you'd either remove -Werror=shadow, or use -Wshadow=local. See this discussion
version: tag v0.1.3
use gnu9.3.0 cmake3.26.0 ubuntu18.04--x86_64
When I encountered this issue while compiling the project:
In file included from /home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/eventdispatcher.h:17,
from /home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/eventqueue.h:17,
from /home/lianyan/5050pp/libvda5050pp/src/../include/private/vda5050++/core/action_event_manager.h:11,
from /home/lianyan/5050pp/libvda5050pp/src/../include/private/vda5050++/core/instance.h:18,
from /home/lianyan/5050pp/libvda5050pp/src/vda5050++/config.cpp:16:
/home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/callbacklist.h: 在构造函数‘eventpp::internal::CallbackListBase<ReturnType(Args ...), PoliciesType>::Node::Node(const Callback&, eventpp::internal::CallbackListBase<ReturnType(Args ...), PoliciesType>::Node::Counter)’中:
/home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/callbacklist.h:64:4: 错误:declaration of ‘counter’ shadows a member of ‘eventpp::internal::CallbackListBase<ReturnType(Args ...), PoliciesType>::Node’ [-Werror=shadow]
64 | : callback(callback), counter(counter)
| ^
/home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/callbacklist.h:71:11: 附注:被隐藏的声明在这里
71 | Counter counter;
| ^~~~~~~
/home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/callbacklist.h:64:4: 错误:declaration of ‘callback’ shadows a member of ‘eventpp::internal::CallbackListBase<ReturnType(Args ...), PoliciesType>::Node’ [-Werror=shadow]
64 | : callback(callback), counter(counter)
| ^
/home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/callbacklist.h:70:13: 附注:被隐藏的声明在这里
70 | Callback callback;
| ^~~~~~~~
In file included from /home/lianyan/5050pp/libvda5050pp/src/../include/private/vda5050++/core/action_event_manager.h:11,
from /home/lianyan/5050pp/libvda5050pp/src/../include/private/vda5050++/core/instance.h:18,
from /home/lianyan/5050pp/libvda5050pp/src/vda5050++/config.cpp:16:
/home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/eventqueue.h: 在构造函数‘eventpp::internal::EventQueueBase<EventType, ReturnType(Args ...), Policies_>::DisableQueueNotify::DisableQueueNotify(eventpp::internal_::EventQueueBase<EventType_, ReturnType(Args ...), Policies_>*)’中:
/home/lianyan/5050pp/libvda5050pp/build/deps/eventpp-src/include/eventpp/eventqueue.h:104:4: 错误:declaration of ‘queue’ shadows a member of ‘eventpp::internal::EventQueueBase<EventType_, ReturnType(Args ...), Policies_>::DisableQueueNotify’ [-Werror=shadow]
104 | : queue(queue)
| ^
/home/lianyan/5050pp/libvda5050pp/build/_deps/eventpp-src/include/eventpp/eventqueue.h:118:20: 附注:被隐藏的声明在这里
118 | EventQueueBase * queue;
| ^~~~~
In file included from /home/lianyan/5050pp/libvda5050pp/src/../include/private/vda5050++/core/action_event_manager.h:12,
from /home/lianyan/5050pp/libvda5050pp/src/../include/private/vda5050++/core/instance.h:18,
from /home/lianyan/5050pp/libvda5050pp/src/vda5050++/config.cpp:16:
/home/lianyan/5050pp/libvda5050pp/build/_deps/eventpp-src/include/eventpp/utilities/scopedremover.h: 在构造函数‘eventpp::ScopedRemover<DispatcherType, typename std::enable_if<std::is_base_of<eventpp::TagEventDispatcher, DispatcherType>::value>::type>::ScopedRemover(DispatcherType&)’中:
/home/lianyan/5050pp/libvda5050pp/build/_deps/eventpp-src/include/eventpp/utilities/scopedremover.h:69:3: 错误:declaration of ‘dispatcher’ shadows a member of ‘eventpp::ScopedRemover<DispatcherType, typename std::enable_if<std::is_base_of<eventpp::TagEventDispatcher, DispatcherType>::value>::type>’ [-Werror=shadow]
69 | : dispatcher(&dispatcher)
| ^
/home/lianyan/5050pp/libvda5050pp/build/_deps/eventpp-src/include/eventpp/utilities/scopedremover.h:186:19: 附注:被隐藏的声明在这里
186 | DispatcherType * dispatcher;
| ^~~~~~~~~~
/home/lianyan/5050pp/libvda5050pp/build/_deps/eventpp-src/include/eventpp/utilities/scopedremover.h: 在构造函数‘eventpp::ScopedRemover<CallbackListType, typename std::enable_if<std::is_base_of<eventpp::TagCallbackList, CallbackListType>::value>::type>::ScopedRemover(CallbackListType&)’中:
/home/lianyan/5050pp/libvda5050pp/build/_deps/eventpp-src/include/eventpp/utilities/scopedremover.h:210:3: 错误:declaration of ‘callbackList’ shadows a member of ‘eventpp::ScopedRemover<CallbackListType, typename std::enable_if<std::is_base_of<eventpp::TagCallbackList, CallbackListType>::value>::type>’ [-Werror=shadow]
210 | : callbackList(&callbackList)
| ^
/home/lianyan/5050pp/libvda5050pp/build/_deps/eventpp-src/include/eventpp/utilities/scopedremover.h:321:21: 附注:被隐藏的声明在这里
321 | CallbackListType * callbackList;
| ^~~~~~~~~~~~
cc1plus:所有的警告都被当作是错误
how to fix this?
The text was updated successfully, but these errors were encountered: