public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15552] New: template inheritance does not recognize member variables
@ 2004-05-21 12:00 ziv at kashya dot com
  2004-05-21 12:29 ` [Bug c++/15552] " pcarlini at suse dot de
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: ziv at kashya dot com @ 2004-05-21 12:00 UTC (permalink / raw)
  To: gcc-bugs

I have a simple c++ file (no header files) that compiles well with g++ 3.0.2 
and also, the original code (before simplification) that caused errors compiles 
on the 3.3 series. The file has a template class with a public member function 
and a derivative class. The derivative class does not recognize the member 
variable.
The gcc version is 3.4.0 compiled on Linux

The c++ file is (note that it does not use ANY headers)
template<class A>
  class Base {
  public:
    Base(const A& a_ber) {};
    virtual ~Base();
    A m_ber;
  };
  
template<class A>
    class Der : public Base<A> {
    public:
	Der(A a_ber): Base<A>(a_ber) {};
	void memFunc();
	void memFunc2();
    };

template<class A>
void Der<A>::memFunc()
{
  A temp = m_ber;
}

template<class A>
void Der<A>::memFunc2()
{
  A temp = Base<A>::m_ber;
}

int main(int argc,char**argv) {
  Der<int> x(3);
  x.memFunc();
  x.memFunc2();
}

=========================================================
The .ii file is:
# 1 "jojo.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "jojo.cc"

template<class A>
  class Base {
  public:
    Base(const A& a_ber) {};
    virtual ~Base();
    A m_ber;
  };

template<class A>
    class Der : public Base<A> {
    public:
 Der(A a_ber): Base<A>(a_ber) {};
 void memFunc();
 void memFunc2();
    };

template<class A>
void Der<A>::memFunc()
{
  A temp = m_ber;
}

template<class A>
void Der<A>::memFunc2()
{
  A temp = Base<A>::m_ber;
}

int main(int argc,char**argv) {
  Der<int> x(3);
  x.memFunc();
  x.memFunc2();
}
=========================================
And the compiler output is:

ziv-lnx:~/temp/logger> /tmp/cross/local/bin/g++ -v jojo.cc -save-temps
Reading specs from /tmp/cross/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ./configure --prefix=/tmp/cross/local --enable-languages=c,c++
Thread model: posix
gcc version 3.4.0
 /tmp/cross/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -E -quiet -v -
D_GNU_SOURCE jojo.cc -mtune=pentiumpro -o jojo.ii
ignoring nonexistent directory "/tmp/cross/local/lib/gcc/i686-pc-linux-
gnu/3.4.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /tmp/cross/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0
 /tmp/cross/local/lib/gcc/i686-pc-linux-
gnu/3.4.0/../../../../include/c++/3.4.0/i686-pc-linux-gnu
 /tmp/cross/local/lib/gcc/i686-pc-linux-
gnu/3.4.0/../../../../include/c++/3.4.0/backward
 /usr/local/include
 /tmp/cross/local/include
 /tmp/cross/local/lib/gcc/i686-pc-linux-gnu/3.4.0/include
 /usr/include
End of search list.
 /tmp/cross/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -fpreprocessed 
jojo.ii -quiet -dumpbase jojo.cc -mtune=pentiumpro -auxbase jojo -version -o 
jojo.s
GNU C++ version 3.4.0 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.0.
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64211
jojo.cc: In member function `void Der<A>::memFunc()':
jojo.cc:21: error: `m_ber' undeclared (first use this function)
jojo.cc:21: error: (Each undeclared identifier is reported only once for each 
function it appears in.)
Exit 1
====================================================
Note that if you comment out the line in memFunc, it compiles well. Also 
memFunc2 has no problems.

-- 
           Summary: template inheritance does not recognize member variables
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ziv at kashya dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
@ 2004-05-21 12:29 ` pcarlini at suse dot de
  2004-11-05 19:29 ` bangerth at dealii dot org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pcarlini at suse dot de @ 2004-05-21 12:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-05-20 10:36 -------
Please, have a look to the 3.4.0 Release Notes, about C++: you are missing a
'this->'. Thanks for your report.

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


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
  2004-05-21 12:29 ` [Bug c++/15552] " pcarlini at suse dot de
@ 2004-11-05 19:29 ` bangerth at dealii dot org
  2004-11-05 19:29 ` bangerth at dealii dot org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:29 -------
*** Bug 18306 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ramya dot chandar at wipro
                   |                            |dot com


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
  2004-05-21 12:29 ` [Bug c++/15552] " pcarlini at suse dot de
  2004-11-05 19:29 ` bangerth at dealii dot org
@ 2004-11-05 19:29 ` bangerth at dealii dot org
  2004-11-05 19:30 ` bangerth at dealii dot org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:29 -------
*** Bug 18061 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ycollet at freesurf dot fr


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (2 preceding siblings ...)
  2004-11-05 19:29 ` bangerth at dealii dot org
@ 2004-11-05 19:30 ` bangerth at dealii dot org
  2004-11-05 19:30 ` bangerth at dealii dot org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:30 -------
*** Bug 18311 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |enrico_groups at libero dot
                   |                            |it


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (3 preceding siblings ...)
  2004-11-05 19:30 ` bangerth at dealii dot org
@ 2004-11-05 19:30 ` bangerth at dealii dot org
  2004-11-05 19:31 ` bangerth at dealii dot org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:30 -------
*** Bug 17649 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon dot marshall at misys
                   |                            |dot com


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (6 preceding siblings ...)
  2004-11-05 19:31 ` bangerth at dealii dot org
@ 2004-11-05 19:31 ` bangerth at dealii dot org
  2004-11-05 19:32 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:31 -------
*** Bug 15801 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |v13 at priest dot com


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (5 preceding siblings ...)
  2004-11-05 19:31 ` bangerth at dealii dot org
@ 2004-11-05 19:31 ` bangerth at dealii dot org
  2004-11-05 19:31 ` bangerth at dealii dot org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:31 -------
*** Bug 17496 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |papadopo at shfj dot cea dot
                   |                            |fr


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (4 preceding siblings ...)
  2004-11-05 19:30 ` bangerth at dealii dot org
@ 2004-11-05 19:31 ` bangerth at dealii dot org
  2004-11-05 19:31 ` bangerth at dealii dot org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:31 -------
*** Bug 18286 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amir at spinux dot com


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (10 preceding siblings ...)
  2004-11-05 19:32 ` bangerth at dealii dot org
@ 2004-11-05 19:32 ` bangerth at dealii dot org
  2004-11-05 19:33 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:32 -------
*** Bug 15639 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |igodard at pacbell dot net


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (8 preceding siblings ...)
  2004-11-05 19:32 ` bangerth at dealii dot org
@ 2004-11-05 19:32 ` bangerth at dealii dot org
  2004-11-05 19:32 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:32 -------
*** Bug 17772 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Serge dot Iovleff at univ-
                   |                            |lille1 dot fr


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (9 preceding siblings ...)
  2004-11-05 19:32 ` bangerth at dealii dot org
@ 2004-11-05 19:32 ` bangerth at dealii dot org
  2004-11-05 19:32 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:32 -------
*** Bug 18144 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |guillaume dot lemaitre33 at
                   |                            |wanadoo dot fr


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (7 preceding siblings ...)
  2004-11-05 19:31 ` bangerth at dealii dot org
@ 2004-11-05 19:32 ` bangerth at dealii dot org
  2004-11-05 19:32 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:32 -------
*** Bug 16713 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marco at technoboredom dot
                   |                            |net


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (11 preceding siblings ...)
  2004-11-05 19:32 ` bangerth at dealii dot org
@ 2004-11-05 19:33 ` bangerth at dealii dot org
  2004-11-05 19:34 ` bangerth at dealii dot org
  2005-05-18 12:37 ` tonne2005 at gehheimdienst dot de
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:32 -------
*** Bug 17403 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |william dot crocker at
                   |                            |analog dot com


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (12 preceding siblings ...)
  2004-11-05 19:33 ` bangerth at dealii dot org
@ 2004-11-05 19:34 ` bangerth at dealii dot org
  2005-05-18 12:37 ` tonne2005 at gehheimdienst dot de
  14 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-11-05 19:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-11-05 19:34 -------
*** Bug 18072 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dwoldrich_ebay at yahoo dot
                   |                            |com


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


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

* [Bug c++/15552] template inheritance does not recognize member variables
  2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
                   ` (13 preceding siblings ...)
  2004-11-05 19:34 ` bangerth at dealii dot org
@ 2005-05-18 12:37 ` tonne2005 at gehheimdienst dot de
  14 siblings, 0 replies; 16+ messages in thread
From: tonne2005 at gehheimdienst dot de @ 2005-05-18 12:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tonne2005 at gehheimdienst dot de  2005-05-18 12:37 -------
*** Bug 21644 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tonne2005 at gehheimdienst
                   |                            |dot de


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


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

end of thread, other threads:[~2005-05-18 12:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-21 12:00 [Bug c++/15552] New: template inheritance does not recognize member variables ziv at kashya dot com
2004-05-21 12:29 ` [Bug c++/15552] " pcarlini at suse dot de
2004-11-05 19:29 ` bangerth at dealii dot org
2004-11-05 19:29 ` bangerth at dealii dot org
2004-11-05 19:30 ` bangerth at dealii dot org
2004-11-05 19:30 ` bangerth at dealii dot org
2004-11-05 19:31 ` bangerth at dealii dot org
2004-11-05 19:31 ` bangerth at dealii dot org
2004-11-05 19:31 ` bangerth at dealii dot org
2004-11-05 19:32 ` bangerth at dealii dot org
2004-11-05 19:32 ` bangerth at dealii dot org
2004-11-05 19:32 ` bangerth at dealii dot org
2004-11-05 19:32 ` bangerth at dealii dot org
2004-11-05 19:33 ` bangerth at dealii dot org
2004-11-05 19:34 ` bangerth at dealii dot org
2005-05-18 12:37 ` tonne2005 at gehheimdienst dot de

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).