[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: non-g++ compilation error in kapplication.cpp
From:       Lubos Lunak <l.lunak () sh ! cvut ! cz>
Date:       2002-01-30 18:13:42
[Download RAW message or body]

On Wed 30. January 2002 14:55, Thomas Leitner wrote:
> like that:
[snip]
> cxx: Error: ./kicontheme.h, line 72: nonmember operator requires a
> parameter
>           with class type (noprmclstyp)
> inline KIcon::Group& operator++(KIcon::Group& group) { group =
> static_cast<KIcon::Group>(group+1); return group; }
> ---------------------^
> cxx: Error: ./kicontheme.h, line 73: nonmember operator requires a
> parameter
>           with class type (noprmclstyp)
> inline KIcon::Group operator++(KIcon::Group& group,int) { KIcon::Group ret
> = group; ++group; return ret; }
> --------------------^
> cxx: Error: ./kicontheme.h, line 73: enumerated type is not allowed
>           (enumtyp)
> inline KIcon::Group operator++(KIcon::Group& group,int) { KIcon::Group ret
> = group; ++group; return ret; }
> ---------------------------------------------------------------------------
>-----------^ cxx: Info: 3 errors detected in the compilation of
> "kapplication.cpp".
>
> Any fix anyone?
>

 Yes ... using an ANSI/ISO C++ capable compiler? The code above should be 
perfectly correct C++, and IIRC e.g. Borland C++ supported it even before the 
newest things like 'mutable' or 'explicit' came. Can your compiler compile 
the attached piece of code (with or without the '#if 0' )?

-- 
 Lubos Lunak
 llunak@suse.cz ; l.lunak@kde.org
 http://dforce.sh.cvut.cz/~seli

["a.cpp" (text/plain)]

enum Num { One, Two, Three, Four };

#if 0
inline Num& operator++(Num& num) { num = static_cast<Num>(num+1); return num; }
#endif

int main()
    {
    for( Num i = One;
         i < Four;
         ++i )
        ;
    return 0;
    }

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic