[Bug c++/24680] Invalid template code accepted

2005-11-07 Thread rnewman at compubrite dot com
--- Comment #17 from rnewman at compubrite dot com 2005-11-07 17:39 --- I concede the argument. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24680

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #16 from pinskia at gcc dot gnu dot org 2005-11-05 03:18 --- Just for later reference the defintion of what a dependent name is slightly different now after the DR: A name is a member of an unknown specialization if the name is a qualified-id in which the nested-name-specifi

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #15 from pinskia at gcc dot gnu dot org 2005-11-05 03:10 --- hold one for a second there is a defect report about this: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#224 See also: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2000/n1251.html So EDG just

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #14 from pinskia at gcc dot gnu dot org 2005-11-05 02:49 --- (In reply to comment #13) > The error which EDG front-end gives: > "ComeauTest.c", line 33: error: a reference of type "int &" (not > const-qualified) > cannot be initialized with a value of type "double"

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #13 from pinskia at gcc dot gnu dot org 2005-11-05 02:33 --- Ok, here is a real testcase which shows that EDG gets it really wrong: #include void resize(double&) { printf("resize::double\n"); } void resize(int&) { printf("resize::int\n"); } template struct List {

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #12 from pinskia at gcc dot gnu dot org 2005-11-05 02:23 --- (In reply to comment #10) > This is really invalid code as List::D::size does not exist but it can > only be diagnost at instaination time. Oh and resize is not declared either but since d->size is dependent as sh

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #11 from pinskia at gcc dot gnu dot org 2005-11-05 02:19 --- So it looks like we have found an EDG bug and not a GCC one. As for >There is no explicit dependence for List::D on the template parameter. >The semantics of D do not change depending upon the instantiation of T.

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia 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 struct List { struct D { int size; }; D *d; List &fill(const T &t, int size = -1); }

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #9 from pinskia at gcc dot gnu dot org 2005-11-05 01:58 --- (In reply to comment #8) Hmm, I assume you are looking at C++03 and not C++98. I was looking at C++98, maybe there was some defect report about this. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24680

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread rnewman at compubrite dot com
--- Comment #8 from rnewman at compubrite dot com 2005-11-05 01:55 --- But 14.6.2.1 says: "Inside a template, some constructs have semantics which may differ from one instantiation to another. Such a construct depends on the template parameters." 14.6.2.2 [Example template struct

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #7 from pinskia at gcc dot gnu dot org 2005-11-05 01:35 --- List::D is by 14.6.2.1 pargagraph 1 point 2: a qufified-id with a nested-name-specifier which contains a class-name that names a dependent type of whos unqualified-if names a dependent type. So by those rules it i

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread rnewman at compubrite dot com
--- Comment #6 from rnewman at compubrite dot com 2005-11-05 01:29 --- Just to be clear: List *is* type dependent. List::D is *not*. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24680

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #5 from pinskia at gcc dot gnu dot org 2005-11-05 01:24 --- this better be type dependent, otherwise it is just useless really. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24680

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread rnewman at compubrite dot com
--- Comment #4 from rnewman at compubrite dot com 2005-11-05 01:21 --- See 14.6.2.1 "Dependent names" and 14.6.3 "Non Dependent name" -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24680

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread ppluzhnikov at charter dot net
--- Comment #3 from ppluzhnikov at charter dot net 2005-11-05 01:17 --- Another variation of the same theme: template List &List::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 accepte

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread rnewman at compubrite dot com
--- Comment #2 from rnewman at compubrite dot com 2005-11-05 01:13 --- (In reply to comment #1) > Hmm, GCC seems to think "size ? 1 : d->size" is type-dependent in a way it is > as D is type dependent. I disagree. D is not type depenendent at all -- it is a struct containing exactly o

[Bug c++/24680] Invalid template code accepted

2005-11-04 Thread pinskia at gcc dot gnu dot org
--- Comment #1 from pinskia at gcc dot gnu dot org 2005-11-05 00:55 --- Hmm, GCC seems to think "size ? 1 : d->size" is type-dependent in a way it is as D is type dependent. Someone else with more knowlege of the C++ standard will have to comment. Another testcase which shows the same i