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++/16577] New: no access for template member of base class


code snipped (adapted) from KDE (synaescope) fails to compile.
Was accepted by 3.2. Not sure if this is incorrect code or a regression. It is
surprizing not to be able to access a public base member.

----------------------------------------------------------------
template<class Pixel>
struct Bitmap
{
  int width;
};

template<class Pixel>
struct PolygonEngine : public Bitmap<Pixel>
{
  void apply(Pixel *dest)
    {
      int count = width;
    }
};
-------------------------------------------------------
g++ -v -c x.cc
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ../gcc-3.4.1/configure --enable-languages=c,c++
Thread model: posix
gcc version 3.4.1
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.1/cc1plus -quiet -v -D_GNU_SOURCE
x.cc -quiet -dumpbase x.cc -mtune=pentiumpro -auxbase x -version -o /tmp/ccjFTwEz.s
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
"/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1/i686-pc-linux-gnu
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.1/include
 /usr/include
End of search list.
GNU C++ version 3.4.1 (i686-pc-linux-gnu)
	compiled by GNU C version 3.4.1.
GGC heuristics: --param ggc-min-expand=80 --param ggc-min-heapsize=94545
x.cc: In member function `void PolygonEngine<Pixel>::apply(Pixel*)':
x.cc:13: error: `width' undeclared (first use this function)
x.cc:13: error: (Each undeclared identifier is reported only once for each
function it appears in.)

Compilation exited abnormally with code 1 at Fri Jul 16 09:07:34


$uname -a
Linux yoda 2.4.20-30.8.legacy #1 Fri Feb 20 18:58:10 PST 2004 i686 athlon i386
GNU/Linux

-- 
           Summary: no access for template member of base class
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pepster at users dot sourceforge dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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