public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Vincent Penquerc'h" <vincent@qubesoft.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: c++/3063: Explicit specification of a template-argument gives syntax error inside a template function. Date: Fri, 08 Jun 2001 02:36:00 -0000 [thread overview] Message-ID: <20010608093601.13007.qmail@sourceware.cygnus.com> (raw) The following reply was made to PR c++/3063; it has been noted by GNATS. From: "Vincent Penquerc'h" <vincent@qubesoft.com> To: <Gabriel.Dos-Reis@cmla.ens-cachan.fr> Cc: <nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org> Subject: Re: c++/3063: Explicit specification of a template-argument gives syntax error inside a template function. Date: Fri, 8 Jun 2001 10:28:21 +0100 Gabriel Dos Reis wrote: > That is nonetheless an unfortunate workaround for a bug in the parser. > Anyway, that is one of the things we plan to fix in the parser rewrite > (soon). Nice to hear that. 3.1 or later ? Another thing that might be of interest is my original testcase, which shows that the code is accepted when its body is inlined in the class definition, but not when it is defined (still inline) outside of it. The in-class verson compiles with 2.95, 2.95.3 and 3.0, the out-of-class version compiles with GCC 2.95, but not with 2.95.3 nor CodeSourcery's web GCC 3.0 compiler. I did not try those with 2.95.1 nor 2.95.2. I was told it was because trying to overload on the return value, which is not allowed, but since I explicitely qualify the template arguments, there is no need for resolution. Even if this code is not valid, I'd be tempted to say that this discrepancy is a compiler bug, and I'd like to know what you GCC C++ hackers think of it. Thanks for your help class Rep { public: template<class Res> inline const Res* Get() const;// {return 0;} }; class Manager { Rep rep; public: template<class Res> const Res *Get() const;// {return rep.Get<Res>();} }; #if 1 template<class Res> inline const Res* Rep::Get() const { return 0; } template<class Res> const Res *Manager::Get() const { return rep.Get<Res>(); } #endif class Res {}; int main() { Manager m; m.Get<Res>(); return 0; } -- Vincent Penquerc'h
next reply other threads:[~2001-06-08 2:36 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-06-08 2:36 Vincent Penquerc'h [this message] -- strict thread matches above, loose matches on Subject: below -- 2001-06-07 15:46 Gabriel Dos Reis 2001-06-07 15:46 Gabriel Dos Reis 2001-06-07 14:56 Phil Edwards 2001-06-07 14:46 Martin Sebor 2001-06-07 14:35 pme 2001-06-06 6:46 carlo
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=20010608093601.13007.qmail@sourceware.cygnus.com \ --to=vincent@qubesoft.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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).