This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3662: Incorrect warnings with overridden virtual functions in template class
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3662: Incorrect warnings with overridden virtual functions in template class
- From: stuart at personalrobots dot com
- Date: 12 Jul 2001 16:15:48 -0000
- Reply-To: stuart at personalrobots dot com
>Number: 3662
>Category: c++
>Synopsis: Incorrect warnings with overridden virtual functions in template class
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 12 09:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: stuart@personalrobots.com
>Release: gcc-3.0
>Organization:
>Environment:
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../gcc-3.0/configure --enable-threads
Thread model: posix
gcc version 3.0
>Description:
Compiling the attached file gives the following error:
test.cpp: In member function `TYPE CList<TYPE>::InvalidValue() [with TYPE =
int]':
test.cpp:11: instantiated from `TYPE CList<TYPE>::RemoveHead() [with TYPE = int]'
test.cpp:39: instantiated from here
test.cpp:14: warning: return to non-pointer type `int' from NULL
test.cpp:14: warning: argument to non-pointer type `int' from NULL
It seems to me that gcc is checking the wrong function and therefore emitting
an incorrect warning - stepping through the running program we never call
TYPE CList<TYPE>::InvalidValue(), only TYPE CTypeList<TYPE>::InvalidValue()
which is correct I believe.
>How-To-Repeat:
Compile the attached file with gcc-3.0
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cc"
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGUgPHR5cGVuYW1lIFRZUEU+CiAgICBjbGFzcyBD
TGlzdAp7CiBwdWJsaWM6CiAgICBDTGlzdCgpIHt9OwogICAgdmlydHVhbCB+Q0xpc3QoKSB7fTsK
CiAgICBUWVBFIFJlbW92ZUhlYWQoKSB7IHJldHVybiBJbnZhbGlkVmFsdWUoKTsgfTsKCiAgICB2
aXJ0dWFsIFRZUEUgSW52YWxpZFZhbHVlKCkgeyByZXR1cm4gTlVMTDsgfTsKCiBwcml2YXRlOgp9
OwoKdGVtcGxhdGUgPHR5cGVuYW1lIFRZUEU+CiAgICBjbGFzcyBDVHlwZUxpc3QgOiBwdWJsaWMg
Q0xpc3Q8VFlQRT4KewogcHVibGljOgogICAgQ1R5cGVMaXN0KCkge307CiAgICB+Q1R5cGVMaXN0
KCkge307CgogICAgdmlydHVhbCBUWVBFIEludmFsaWRWYWx1ZSgpIHsgcmV0dXJuIDA7IH07Cgog
cHJpdmF0ZToKfTsKCmludCBtYWluICggaW50IGFyZ2MsIGNoYXIgKmFyZ3ZbXSApCnsKICAgIENU
eXBlTGlzdDxpbnQ+IGxpc3Q7CgogICAgbGlzdC5SZW1vdmVIZWFkKCk7CgogICAgcmV0dXJuIDA7
Cn0K