public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/4030: stupid warning message about template type
@ 2001-08-15  5:36 khlebnikov
  0 siblings, 0 replies; 2+ messages in thread
From: khlebnikov @ 2001-08-15  5:36 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4030
>Category:       c++
>Synopsis:       stupid warning message about template type
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 15 05:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     g++
>Release:        3.0.1pre20010801, 3.0 release, 2.95.4pre20010319
>Organization:
>Environment:
Intel Pentium II
Progeny Debian 1.0
GCC:
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.1/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.1 20010801 (Debian prerelease)
>Description:
$ g++-3.0 -c error.cpp 
error.cpp:13: warning: lookup of `_TN' finds `class _TN'
error.cpp:13: warning:   instead of `typename B<_NY, _TN>::_TN' from dependent 
   base class
error.cpp:13: warning:   (use `typename B::_TN' if that's what you meant)
===============================================
I use type _TN in class B and I must refer to it
as "B::_TN" ?
>How-To-Repeat:
template <class _TTN, class _TNK>
class A
{
//public:
private:
	typedef _TTN _TN;
};


template <class _NY, class _TN>
class B : virtual public A <_TN, _NY>
{
	_TN func () = 0;
};
>Fix:
1) Do not typedef _TN (even private!) in the base class.
2) Instead of "_TN func () = 0;", write "B::_TN func () = 0;"
   (imagine that the name of class is 20 symbols long and
   you use type _TN 20 tymes).
3) Instead of "template <class _NY, class _TN>", write
   "template <class _TN, class _NY>", i.e. displace types
   in declaration.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="error.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="error.cpp"

dGVtcGxhdGUgPGNsYXNzIF9UVE4sIGNsYXNzIF9UTks+CmNsYXNzIEEKewovL3B1YmxpYzoKcHJp
dmF0ZToKCXR5cGVkZWYgX1RUTiBfVE47Cn07CgoKdGVtcGxhdGUgPGNsYXNzIF9OWSwgY2xhc3Mg
X1ROPgpjbGFzcyBCIDogdmlydHVhbCBwdWJsaWMgQSA8X1ROLCBfTlk+CnsKCV9UTiBmdW5jICgp
ID0gMDsKfTsK


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

* Re: c++/4030: stupid warning message about template type
@ 2002-02-26 14:14 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-02-26 14:14 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, khlebnikov, nobody

Synopsis: stupid warning message about template type

State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Tue Feb 26 14:10:40 2002
State-Changed-Why:
    confirmed - yup, rather silly

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4030


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

end of thread, other threads:[~2002-02-26 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-15  5:36 c++/4030: stupid warning message about template type khlebnikov
2002-02-26 14:14 nathan

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