public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21043] New: Compilation error when trying to call method of a class contain by grand-mother with a  template mother and class
@ 2005-04-15 11:20 maxime dot fiandino at imag dot fr
  2005-04-15 11:57 ` [Bug c++/21043] " maxime dot fiandino at imag dot fr
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: maxime dot fiandino at imag dot fr @ 2005-04-15 11:20 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/21043] Compilation error when trying to call method of a class contain by grand-mother with a  template mother and class
  2005-04-15 11:20 [Bug c++/21043] New: Compilation error when trying to call method of a class contain by grand-mother with a template mother and class maxime dot fiandino at imag dot fr
@ 2005-04-15 11:57 ` maxime dot fiandino at imag dot fr
  2005-04-15 13:00 ` reichelt at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: maxime dot fiandino at imag dot fr @ 2005-04-15 11:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From maxime dot fiandino at imag dot fr  2005-04-15 11:57 -------
Hi, please note that for the same bahavior with the line, it's compiling:

((A*)(this))->m_.p(); 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|g++ main.cc                 |i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/21043] Compilation error when trying to call method of a class contain by grand-mother with a  template mother and class
  2005-04-15 11:20 [Bug c++/21043] New: Compilation error when trying to call method of a class contain by grand-mother with a template mother and class maxime dot fiandino at imag dot fr
  2005-04-15 11:57 ` [Bug c++/21043] " maxime dot fiandino at imag dot fr
@ 2005-04-15 13:00 ` reichelt at gcc dot gnu dot org
  2005-04-15 13:30 ` pinskia at gcc dot gnu dot org
  2005-04-15 13:30 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-04-15 13:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-04-15 12:59 -------
Not a bug.

This has to do with two-stage name-lookup, see last bullet in
http://gcc.gnu.org/bugs.html#new34
and
http://gcc.gnu.org/gcc-3.4/changes.html

You could use
this->m_.p(), this->A::m_.p(), B<T>::A::m_.p()


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/21043] Compilation error when trying to call method of a class contain by grand-mother with a  template mother and class
  2005-04-15 11:20 [Bug c++/21043] New: Compilation error when trying to call method of a class contain by grand-mother with a template mother and class maxime dot fiandino at imag dot fr
                   ` (2 preceding siblings ...)
  2005-04-15 13:30 ` pinskia at gcc dot gnu dot org
@ 2005-04-15 13:30 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-15 13:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-15 13:30 -------
Reopening to mark as ...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/21043] Compilation error when trying to call method of a class contain by grand-mother with a  template mother and class
  2005-04-15 11:20 [Bug c++/21043] New: Compilation error when trying to call method of a class contain by grand-mother with a template mother and class maxime dot fiandino at imag dot fr
  2005-04-15 11:57 ` [Bug c++/21043] " maxime dot fiandino at imag dot fr
  2005-04-15 13:00 ` reichelt at gcc dot gnu dot org
@ 2005-04-15 13:30 ` pinskia at gcc dot gnu dot org
  2005-04-15 13:30 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-15 13:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-15 13:30 -------
a dup of bug 21012.

*** This bug has been marked as a duplicate of 21012 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-04-15 13:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-15 11:20 [Bug c++/21043] New: Compilation error when trying to call method of a class contain by grand-mother with a template mother and class maxime dot fiandino at imag dot fr
2005-04-15 11:57 ` [Bug c++/21043] " maxime dot fiandino at imag dot fr
2005-04-15 13:00 ` reichelt at gcc dot gnu dot org
2005-04-15 13:30 ` pinskia at gcc dot gnu dot org
2005-04-15 13:30 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).