public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15801] New: g++ fails to identify member variables in templates
@ 2004-06-03 19:12 gcc-bugzilla at gcc dot gnu dot org
  2004-06-03 19:15 ` [Bug c++/15801] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-06-03 19:12 UTC (permalink / raw)
  To: gcc-bugs

	g++ produces bad error for member variables. See how-to-repeat.
	This error is triggered in kde 3.3 / kdeaddons.

Environment:
System: Linux hell.hell.gr 2.6.6 #35 Sat May 29 20:08:29 EEST 2004 i686 unknown unknown GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.4.0/configure --enable-threads=posix --prefix=/usr --enable-languages=c,c++ --enable-shared --with-arch=pentium3 --with-cpu=pentium3 --enable-__cxa_atexit

How-To-Repeat:
Using this source:

template<class tA> struct A
{
	int var1;
}

template<class tB> struct B : public A<tB>
{
	void a()
	{
		int var2 = var1;
	}
}

gives:

$ g++ a.c -c -o a.o
a.c: In member function `void B<tB>::a()':
a.c:10: error: `var1' undeclared (first use this function)
a.c:10: error: (Each undeclared identifier is reported only once for each function it appears in.)
------- Additional Comments From v13 at priest dot com  2004-06-03 19:12 -------
Fix:
	This will make it work as expected:

        void a()
        {
-               int var2 = var1;
+               int var2 = this->var1;
        }

-- 
           Summary: g++ fails to identify member variables in templates
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: v13 at priest dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2004-11-05 19:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-03 19:12 [Bug c++/15801] New: g++ fails to identify member variables in templates gcc-bugzilla at gcc dot gnu dot org
2004-06-03 19:15 ` [Bug c++/15801] " pinskia at gcc dot gnu dot org
2004-06-03 19:25 ` v13 at it dot teithe dot gr
2004-06-03 19:33 ` pinskia at gcc dot gnu dot org
2004-11-05 19:28 ` bangerth at dealii dot org
2004-11-05 19:32 ` bangerth at dealii 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).