Bug or Bogus?

Thomas Weise tw4@irz301.inf.tu-dresden.de
Tue Sep 16 09:45:00 GMT 1997


> I'm wondering if the following snipped of code is just wrong:
> 
> class foo
> {
>   public:
>    static int f();
>    // bar is just a friend of static member foo::f(), what has been
>    // already declared

At least this is bogus: Obviously foo::f() should be a fried of foo::bar..

>    class bar {
>      friend int foo::f();
>    };
> };
>  
> int main()
> {
>    return 0;
> }
> 
> 
> test > g++ -v x12.cc
> Reading specs from
> /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.06/specs
> gcc version egcs-2.90.06 970907 (gcc2-970802 experimental)
>  /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.06/cpp -lang-c++ -v
> -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90
> -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix
> -D__linux -Asystem(posix) -D__EXCEPTIONS -Di386 -Di586 -Asystem(unix)
> -Acpu(i386) -Amachine(i386) -D__i386__ -D__i586__ -Asystem(unix)
> -Acpu(i386) -Amachine(i386) x12.cc /tmp/cca11884.ii
> GNU CPP version egcs-2.90.06 970907 (gcc2-970802 experimental) (i386
> Linux/ELF)
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/include/g++
>  /usr/i586-pc-linux-gnulibc1/include
>  /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.06/include
>  /usr/include
> End of search list.
>  /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.06/cc1plus
> /tmp/cca11884.ii -quiet -dumpbase x12.cc -version -o /tmp/cca11884.s
> GNU C++ version egcs-2.90.06 970907 (gcc2-970802 experimental)
> (i586-pc-linux-gnulibc1) compiled by GNU C version egcs-2.90.06 970907
> (gcc2-970802 experimental).
> x12.cc:7: member `foo::f()' declared as friend before type `foo' defined
> 
> 
> Thomas Weise, http://www.inf.tu-dresden.de/~tw4
> Dresden University of Technology, Department of Computer Science  
> 
> 




More information about the Gcc mailing list