I will give full details about my compiler version at the end of this message.


piece of code I tried to run:

  1 
  2 
  3 #include <iostream>
  4 
  5 using namespace std;
  6 
  7 
  8 
  9 
 10 
 11 class A {
 12     friend class AOnClick;
 13 private:
 14     int g;
 15 public:
 16      A(){ r = 300 ; g=20;};
 17     ~A(){};
 18     int r;
 19 };
 20 
 21 
 22 
 23 
 24 
 25 
 26 int main() {
 27     A a;
 28 
 29     class AOnClick {
 30         friend class A;
 31         public:
 32             AOnClick(A* a1) { cout<<a1->g;} ;
 33             ~AOnClick() {};
 34     } aonclick(&a);
 35 
 36     return 0;
 37 }





The message I receieved:



implementation_outside.cpp: In function ‘int main()’:
implementation_outside.cpp:32: internal compiler error: in lookup_name_real, at
cp/name-lookup.c:4010
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/ccgvFQ3G.out file, please attach this to
your bugreport.



The full details about the compiler I'm using:




Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)


-- 
           Summary: friend class expected to have access over a class-es
                    private members but doesn't and gives "internal compile
                    error"
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stefan dot petrea at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37570

Reply via email to