public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9821: Problems with using declarations and derived templates
@ 2003-02-24  6:26 peter
  0 siblings, 0 replies; only message in thread
From: peter @ 2003-02-24  6:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9821
>Category:       c++
>Synopsis:       Problems with using declarations and derived templates
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 06:26:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Peter Schmid
>Release:        3.4 20030216 (experimental)
>Organization:
LBNL
>Environment:
System: Linux linux 2.4.19-4GB #1 Wed Nov 27 00:56:40 UTC 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-threads=posix --enable-languages=c,c++,f77,objc --enable-__cxa_atexit --disable-nls
>Description:
According to book "C++ Templates: The Complete Guide" by Vandevoorde
and Josuttis the following source code u.C is legal (cf. page
138--139). Although previous g++ versions accept this code current g++
compiler snapshots reject this code. IMHO this is a severe regression
breaking the build of blitz, pooma and mtl.
>How-To-Repeat:
source code u.C

template<typename T>
class Base
{
public:
    int basefield;
};

template<typename T>
class Derived : public Base<T>
{
public:
    using Base<T>::basefield;

    void f()
    {
      basefield = 0;
      this->basefield=0;
      Base<T>::basefield=0;
    }
};

Compiling u.C

g++ -v -c -W -Wall u.C
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --enable-threads=posix --enable-languages=c,c++,f77,objc --enable-__cxa_atexit --disable-nls
Thread model: posix
gcc version 3.4 20030216 (experimental)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=0 -D_GNU_SOURCE u.C -D__GNUG__=3 -quiet -dumpbase u.C -auxbase u -W -Wall -version -o /tmp/cc9t5Qa2.s
GNU C++ version 3.4 20030216 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 3.4 20030216 (experimental).
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/c++/3.4
 /usr/local/include/c++/3.4/i686-pc-linux-gnu
 /usr/local/include/c++/3.4/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/include
 /usr/include
End of search list.
u.C: In member function `void Derived<T>::f()':
u.C:16: error: `basefield' has not been declared

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-24  6:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-24  6:26 c++/9821: Problems with using declarations and derived templates peter

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