This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Make safe_iterator inline friends


On 22/08/18 23:08 +0200, François Dumont wrote:
Only operator== and != remains outside _Safe_iterator because all my attempts to make them inline friends failed. I understand that an inline friend within a base class is not a very clean design.

Compiler error was:

/home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/safe_iterator.h:459: error: redefinition of 'bool __gnu_debug::operator==(const _Self&, const _OtherSelf&)' /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/safe_iterator.h:452: note: 'bool __gnu_debug::operator==(const _Self&, const _Self&)' previously declared here /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/safe_iterator.h:473: error: redefinition of 'bool __gnu_debug::operator!=(const _Self&, const _OtherSelf&)' /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/safe_iterator.h:466: note: 'bool __gnu_debug::operator!=(const _Self&, const _Self&)' previously declared here

I don't know if it is a compiler issue

I don't think so. The error seems clear: when _Self and _OtherSelf are
the same type the friend declarations are the same function.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]