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++/24680] Invalid template code accepted



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


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