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: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Nov 2005 02:18:02 -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 #10 from pinskia at gcc dot gnu dot org 2005-11-05 02:18 -------
(In reply to comment #9)
Never mind that, the numbers have changed a little.
Take the following example:
template <typename T>
struct List
{
struct D { int size; };
D *d;
List &fill(const T &t, int size = -1);
};
template<>
struct List<int>::D
{
int d;
};
template <typename T>
List<T> &List<T>::fill(const T &t, int size)
{
resize(d->size);
return *this;
}
int main(void)
{
List<int> a;
a.fill(1, 1);
}
This is really invalid code as List<int>::D::size does not exist but it can
only be diagnost at instaination time.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24680