This is the mail archive of the gcc-bugs@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]

[Bug c++/21043] New: Compilation error when trying to call method of a class contain by grand-mother with a template mother and class


g++ -v
Reading specs from
/.../Open-Sources/gcc/gcc-3.4.3/linux-x86/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: /.../Open-Sources/gcc/gcc-3.4.3/src/configure
--prefix=/.../Open-Sources/gcc/gcc-3.4.3/linux-x86
Thread model: posix
gcc version 3.4.3



When i try to compile this code there is an error but it's compiling fine with
"comeau online":
main.cc: In constructor `C<T>::C()':
main.cc:10: error: object missing in reference to `A::m_'
main.cc:25: error: from this location

But it's working fine with this->m_.p();  insteed of A::m_.p();

Following main.ii

# 1 "main.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "main.cc"

struct X
{
  void p()
  { ; }

};

struct A{
   X m_;
};

template<typename T>
struct B : public A
{
   B():A(){Y=0;}
int Y;
};

template<typename T>
struct C : public B<T>
{
   C():B<T>()
   {
   A::m_.p();

   Z=0;
   }

T Z;
};


int main()
{
C<int> test;
return(1);
}

-- 
           Summary: Compilation error when trying to call method of a class
                    contain by grand-mother with a  template mother and
                    class
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: maxime dot fiandino at imag dot fr
                CC: gcc-bugs at gcc dot gnu dot org,maxime dot fiandino at
                    imag dot fr
 GCC build triplet: g++ main.cc
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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