From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10844 invoked by alias); 5 Nov 2005 02:33:56 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 10830 invoked by uid 48); 5 Nov 2005 02:33:51 -0000 Date: Sat, 05 Nov 2005 02:33:00 -0000 Message-ID: <20051105023351.10829.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/24680] Invalid template code accepted In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gcc dot gnu dot org" X-SW-Source: 2005-11/txt/msg00718.txt.bz2 List-Id: ------- 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 { struct D { int size; }; D *d; List &fill(const T &t, int size = -1); }; template<> struct List::D { double size; }; template List &List::fill(const T &t, int size) { resize(d->size); return *this; } int main(void) { List a; a.fill(1, 1); return 0; } ------- So you found a bug in EDG and not GCC. 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" resize(d->size); ^ detected during instantiation of "List &List::fill(const T &, int) [with T=int]" 1 error detected in the compilation of "ComeauTest.c". Which does not make sense at all since List::D is type dependent and so is d->size as shown above. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24680