Closed guignont closed 3 weeks ago
The warning is only with old version of GCC (before version 11). You can remove it using -Wno-Wunused-value
during compilation.
The code using HasInternalRemoveReference
and HasInternalAddReference
works in Arccore. In your example, it does not work because you are using the method data()
and this method is overloaded for std::vector
so decltype(&T::data)
is ambiguous and so it is not valid. If you use a method which is not overloaded (for example size()
), it will works.
The above code is only for compatibility with previous versions of Arccore and will be removed in the future. When C++20 will be used everywhere I will replace it using concepts.
Thank you for the explanation
The file arccore/src/base/arccore/base/RefDeclarations.h generates lots of warnings when compiling client code, exemple:
/work/guignont/work/ArcaneV3/framework/cmake-build-debug-arcane_gimkl2018b/_common/build_all/alien/ArcaneInterface/install/1.0.0/include/arccore/base/RefDeclarations.h:118:75: warning: l'opérande de gauche de l'opérateur virgule n'a pas d'effet [-Wunused-value] /work/guignont/work/ArcaneV3/framework/cmake-build-debug-arcane_gimkl2018b/_common/build_all/alien/ArcaneInterface/install/1.0.0/include/arccore/base/RefDeclarations.h: Dans l'instanciation de « struct Arccore::impl::HasInternalAddReference<Arcane::CaseOptionMultiServiceImpl, int> » : /work/guignont/work/ArcaneV3/framework/cmake-build-debug-arcane_gimkl2018b/_common/build_all/alien/ArcaneInterface/install/1.0.0/include/arccore/base/RefDeclarations.h:152:5: requis par « static void Arccore::ReferenceCounterAccessor::addReference(T) [with T = Arcane::CaseOptionMultiServiceImpl] »
/work/guignont/work/ArcaneV3/framework/cmake-build-debug-arcane_gimkl2018b/_common/build_all/alien/ArcaneInterface/install/1.0.0/include/arccore/base/ReferenceCounter.h:96:48: requis par « void Arccore::ReferenceCounter::_changeValue(T ) [with T = Arcane::CaseOptionMultiServiceImpl] »
/work/guignont/work/ArcaneV3/framework/cmake-build-debug-arcane_gimkl2018b/_common/build_all/alien/ArcaneInterface/install/1.0.0/include/arccore/base/ReferenceCounter.h:58:70: requis par « Arccore::ReferenceCounter::ReferenceCounter(T*) [with T = Arcane::CaseOptionMultiServiceImpl] »
/work/guignont/work/ArcaneV3/framework/cmake-build-debug-arcane_gimkl2018b/_common/build_all/alien/ArcaneInterface/install/1.0.0/include/arcane/core/CaseOptionService.h:265:58: requis depuis ici
/work/guignont/work/ArcaneV3/framework/cmake-build-debug-arcane_gimkl2018b/_common/build_all/alien/ArcaneInterface/install/1.0.0/include/arccore/base/RefDeclarations.h:130:69: warning: l'opérande de gauche de l'opérateur virgule n'a pas d'effet [-Wunused-value]
struct HasInternalAddReference<T, decltype(&T::_internalAddReference, 0)>