From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Vincent Penquerc'h" 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 Message-id: <20010608093601.13007.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00286.html List-Id: The following reply was made to PR c++/3063; it has been noted by GNATS. From: "Vincent Penquerc'h" To: Cc: , 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 inline const Res* Get() const;// {return 0;} }; class Manager { Rep rep; public: template const Res *Get() const;// {return rep.Get();} }; #if 1 template inline const Res* Rep::Get() const { return 0; } template const Res *Manager::Get() const { return rep.Get(); } #endif class Res {}; int main() { Manager m; m.Get(); return 0; } -- Vincent Penquerc'h