This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24680] Invalid template code accepted
- From: "ppluzhnikov at charter dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Nov 2005 01:17:26 -0000
- Subject: [Bug c++/24680] Invalid template code accepted
- References: <bug-24680-8671@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from ppluzhnikov at charter dot net 2005-11-05 01:17 -------
Another variation of the same theme:
template <typename T>
List<T> &List<T>::fill(const T &t, int size)
{
this->resize(1);
this->resize(d->size);
return *this;
}
$ /usr/local/gcc-4.1/bin/g++ -c junk.cc
# silently accepted
$ edgcpfe --gnu_version=30400 junk.cc
"junk.cc", line 13: error: class template "List<T>" has no member "resize"
this->resize(1);
^
"junk.cc", line 14: error: class template "List<T>" has no member "resize"
this->resize(d->size);
^
2 errors detected in the compilation of "junk.cc".
# same errors with 'edgcpfe --strict'
BTW, the test case is reduced from Qt4 sources, where 'resize()' is a typo:
reserve() was intended. IOW, g++ is hiding the bug from Qt developers.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24680