A C++ question: when to use "friend class"/"friend template"

Mojca Miklavec mojca at macports.org
Sat Aug 17 23:55:11 PDT 2013


Hello,

While this might not be the most appropriate list to ask this type
questions, I hope that there is someone who might be able to help.

When trying to upgrade a port (hugin-app in particular) I had to
modify the following code:

 #ifdef __GNUC__
 friend class Notify::self_type;
 #else
 friend typename Notify::self_type;
 #endif

The Clang compiler (Xcode Xcode 4.6.3 on Lion) failed to work with
"friend class Notify::self_type;". As a temporary patch I removed
#ifdef and made the compiler always end up seeing the code "friend
typename Notify::self_type;", but I believe that this will break the
gcc compilers (I didn't try though because compilation takes forever).

Does anyone know what the proper patch should be?

Thank you,
    Mojca

PS: the latest version of hugin-app claims to work with wxWidgets 2.9
even though it's stated to be experimental. But most problems with
compiling that new version arise from linking to boost.


More information about the macports-dev mailing list