public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/24680] Invalid template code accepted Date: Sat, 05 Nov 2005 02:33:00 -0000 [thread overview] Message-ID: <20051105023351.10829.qmail@sourceware.org> (raw) In-Reply-To: <bug-24680-8671@http.gcc.gnu.org/bugzilla/> ------- 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 <stdio.h> void resize(double&) { printf("resize::double\n"); } void resize(int&) { printf("resize::int\n"); } template <typename T> struct List { struct D { int size; }; D *d; List &fill(const T &t, int size = -1); }; template<> struct List<int>::D { double size; }; 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); 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<T> &List<T>::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<T>::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
next prev parent reply other threads:[~2005-11-05 2:33 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-11-05 0:44 [Bug c++/24680] New: [accept invalid] " ppluzhnikov at charter dot net 2005-11-05 0:55 ` [Bug c++/24680] " pinskia at gcc dot gnu dot org 2005-11-05 1:14 ` rnewman at compubrite dot com 2005-11-05 1:17 ` ppluzhnikov at charter dot net 2005-11-05 1:21 ` rnewman at compubrite dot com 2005-11-05 1:24 ` pinskia at gcc dot gnu dot org 2005-11-05 1:29 ` rnewman at compubrite dot com 2005-11-05 1:35 ` pinskia at gcc dot gnu dot org 2005-11-05 1:55 ` rnewman at compubrite dot com 2005-11-05 1:58 ` pinskia at gcc dot gnu dot org 2005-11-05 2:18 ` pinskia at gcc dot gnu dot org 2005-11-05 2:19 ` pinskia at gcc dot gnu dot org 2005-11-05 2:23 ` pinskia at gcc dot gnu dot org 2005-11-05 2:33 ` pinskia at gcc dot gnu dot org [this message] 2005-11-05 2:49 ` pinskia at gcc dot gnu dot org 2005-11-05 3:10 ` pinskia at gcc dot gnu dot org 2005-11-05 3:18 ` pinskia at gcc dot gnu dot org 2005-11-07 17:39 ` rnewman at compubrite dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20051105023351.10829.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).