public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Suspected template parsing bug.
@ 1999-02-27 19:18 Bob Steagall
       [not found] ` < 3.0.3.32.19990227221538.009f30b0@pop.apk.net >
  1999-02-28 22:53 ` Bob Steagall
  0 siblings, 2 replies; 9+ messages in thread
From: Bob Steagall @ 1999-02-27 19:18 UTC (permalink / raw)
  To: egcs, egcs-bugs

At 09:35 PM 2/27/99 -0500, you wrote:
>The following declaration gets a "parse error before '<'" that appears to
>be spurious:
>
>static X &transform (const BinOp &op,
>                     X &x,
>                     typename math_traits<
>                       typename X::rebind<
>                         typename __ref_remover<
>                           typename BinOp::second_argument_type
>                         >::value_type
>                       >::other
>                     >::pass_type y) throw ();
>
>As you can see, all the aggressive "typename"ing in the world to qualify
>what template args are types doesn't prevent the error message.

If X::rebind is fashioned in the same vein as std::allocator<T>::rebind<U>,
then you must qualify it with the 'template' keyword.

  ... typename X::template rebind< ....

--Bob

====================================================================
Bob Steagall                                 steagall@deltalogic.com
DeltaLogic, Inc.                           http://www.deltalogic.com
Voice (216) 321-8200                              Fax (216) 321-6976

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Suspected template parsing bug.
       [not found] ` < 3.0.3.32.19990227221538.009f30b0@pop.apk.net >
@ 1999-02-27 21:43   ` Paul Derbyshire
  1999-02-28 22:53     ` Paul Derbyshire
  1999-03-01  9:02     ` Alexandre Oliva
  0 siblings, 2 replies; 9+ messages in thread
From: Paul Derbyshire @ 1999-02-27 21:43 UTC (permalink / raw)
  To: egcs

At 10:15 PM 2/27/99 -0500, you wrote:
>If X::rebind is fashioned in the same vein as std::allocator<T>::rebind<U>,
>then you must qualify it with the 'template' keyword.
>
>  ... typename X::template rebind< ....

1. Not according to Stroustrup 3rd Ed, aka 'source'.
2. The code in question compiles once I fix the real error, which is
   that "math_traits" wasn't in scope. The bug has proven on close
   inspection to be that egcs is emitting the wrong error message
   soemtimes when the real error is an undeclared identifier.

-- 
   .*.  "Clouds are not spheres, mountains are not cones, coastlines are not
-()  <  circles, and bark is not smooth, nor does lightning travel in a
   `*'  straight line."    -------------------------------------------------
        -- B. Mandelbrot  | http://surf.to/pgd.net
_____________________ ____|________     Paul Derbyshire     pderbysh@usa.net
Programmer & Humanist|ICQ: 10423848|

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Suspected template parsing bug.
  1999-02-27 21:43   ` Paul Derbyshire
@ 1999-02-28 22:53     ` Paul Derbyshire
  1999-03-01  9:02     ` Alexandre Oliva
  1 sibling, 0 replies; 9+ messages in thread
From: Paul Derbyshire @ 1999-02-28 22:53 UTC (permalink / raw)
  To: egcs

At 10:15 PM 2/27/99 -0500, you wrote:
>If X::rebind is fashioned in the same vein as std::allocator<T>::rebind<U>,
>then you must qualify it with the 'template' keyword.
>
>  ... typename X::template rebind< ....

1. Not according to Stroustrup 3rd Ed, aka 'source'.
2. The code in question compiles once I fix the real error, which is
   that "math_traits" wasn't in scope. The bug has proven on close
   inspection to be that egcs is emitting the wrong error message
   soemtimes when the real error is an undeclared identifier.

-- 
   .*.  "Clouds are not spheres, mountains are not cones, coastlines are not
-()  <  circles, and bark is not smooth, nor does lightning travel in a
   `*'  straight line."    -------------------------------------------------
        -- B. Mandelbrot  | http://surf.to/pgd.net
_____________________ ____|________     Paul Derbyshire     pderbysh@usa.net
Programmer & Humanist|ICQ: 10423848|

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Suspected template parsing bug.
  1999-02-27 19:18 Suspected template parsing bug Bob Steagall
       [not found] ` < 3.0.3.32.19990227221538.009f30b0@pop.apk.net >
@ 1999-02-28 22:53 ` Bob Steagall
  1 sibling, 0 replies; 9+ messages in thread
From: Bob Steagall @ 1999-02-28 22:53 UTC (permalink / raw)
  To: egcs, egcs-bugs

At 09:35 PM 2/27/99 -0500, you wrote:
>The following declaration gets a "parse error before '<'" that appears to
>be spurious:
>
>static X &transform (const BinOp &op,
>                     X &x,
>                     typename math_traits<
>                       typename X::rebind<
>                         typename __ref_remover<
>                           typename BinOp::second_argument_type
>                         >::value_type
>                       >::other
>                     >::pass_type y) throw ();
>
>As you can see, all the aggressive "typename"ing in the world to qualify
>what template args are types doesn't prevent the error message.

If X::rebind is fashioned in the same vein as std::allocator<T>::rebind<U>,
then you must qualify it with the 'template' keyword.

  ... typename X::template rebind< ....

--Bob

====================================================================
Bob Steagall                                 steagall@deltalogic.com
DeltaLogic, Inc.                           http://www.deltalogic.com
Voice (216) 321-8200                              Fax (216) 321-6976


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Suspected template parsing bug.
  1999-02-27 21:43   ` Paul Derbyshire
  1999-02-28 22:53     ` Paul Derbyshire
@ 1999-03-01  9:02     ` Alexandre Oliva
  1999-03-31 23:46       ` Alexandre Oliva
  1 sibling, 1 reply; 9+ messages in thread
From: Alexandre Oliva @ 1999-03-01  9:02 UTC (permalink / raw)
  To: Paul Derbyshire; +Cc: egcs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

On Feb 28, 1999, Paul Derbyshire <pderbysh@usa.net> wrote:

> At 10:15 PM 2/27/99 -0500, you wrote:
>> If X::rebind is fashioned in the same vein as std::allocator<T>::rebind<U>,
>> then you must qualify it with the 'template' keyword.
>> 
>> ... typename X::template rebind< ....

> 1. Not according to Stroustrup 3rd Ed, aka 'source'.

Sorry, Stroustrup is ``wrong''.  The C++ Standard requires both
typename and template in this case.

> 2. The code in question compiles once I fix the real error, which is
>    that "math_traits" wasn't in scope.

Even with -ansi -pedantic?  It should reject the code in this case.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org,computer.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Instituto de Computação, Universidade Estadual de Campinas, SP, Brasil

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Suspected template parsing bug.
  1999-03-01  9:02     ` Alexandre Oliva
@ 1999-03-31 23:46       ` Alexandre Oliva
  0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Oliva @ 1999-03-31 23:46 UTC (permalink / raw)
  To: Paul Derbyshire; +Cc: egcs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 839 bytes --]

On Feb 28, 1999, Paul Derbyshire <pderbysh@usa.net> wrote:

> At 10:15 PM 2/27/99 -0500, you wrote:
>> If X::rebind is fashioned in the same vein as std::allocator<T>::rebind<U>,
>> then you must qualify it with the 'template' keyword.
>> 
>> ... typename X::template rebind< ....

> 1. Not according to Stroustrup 3rd Ed, aka 'source'.

Sorry, Stroustrup is ``wrong''.  The C++ Standard requires both
typename and template in this case.

> 2. The code in question compiles once I fix the real error, which is
>    that "math_traits" wasn't in scope.

Even with -ansi -pedantic?  It should reject the code in this case.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org,computer.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Instituto de Computação, Universidade Estadual de Campinas, SP, Brasil


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Suspected template parsing bug.
  1999-02-27 19:07 ` Joe Buck
@ 1999-02-28 22:53   ` Joe Buck
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Buck @ 1999-02-28 22:53 UTC (permalink / raw)
  To: Paul Derbyshire; +Cc: egcs, egcs-bugs

> The following declaration gets a "parse error before '<'" that appears to
> be spurious:
> 
> static X &transform (const BinOp &op,
>                      X &x,
>                      typename math_traits<
>                        typename X::rebind<
>                          typename __ref_remover<
>                            typename BinOp::second_argument_type
>                          >::value_type
>                        >::other
>                      >::pass_type y) throw ();

You may well have found a bug, but without a complete program (where are
X, math_traits, rebind, etc defined?) no one will be able to debug the
problem.  Please resend with a complete program (preprocessor output
from the file you're trying to compile is one possibility).

> As you can see, all the aggressive "typename"ing in the world to qualify
> what template args are types doesn't prevent the error message.

The typename keyword will probably not make a difference in this case,
since this is not a template definition.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Suspected template parsing bug.
@ 1999-02-28 22:53 Paul Derbyshire
  1999-02-27 19:07 ` Joe Buck
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Derbyshire @ 1999-02-28 22:53 UTC (permalink / raw)
  To: egcs, egcs-bugs

The following declaration gets a "parse error before '<'" that appears to
be spurious:

static X &transform (const BinOp &op,
                     X &x,
                     typename math_traits<
                       typename X::rebind<
                         typename __ref_remover<
                           typename BinOp::second_argument_type
                         >::value_type
                       >::other
                     >::pass_type y) throw ();

As you can see, all the aggressive "typename"ing in the world to qualify
what template args are types doesn't prevent the error message.

-- 
   .*.  "Clouds are not spheres, mountains are not cones, coastlines are not
-()  <  circles, and bark is not smooth, nor does lightning travel in a
   `*'  straight line."    -------------------------------------------------
        -- B. Mandelbrot  | http://surf.to/pgd.net
_____________________ ____|________     Paul Derbyshire     pderbysh@usa.net
Programmer & Humanist|ICQ: 10423848|

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Suspected template parsing bug.
  1999-02-28 22:53 Paul Derbyshire
@ 1999-02-27 19:07 ` Joe Buck
  1999-02-28 22:53   ` Joe Buck
  0 siblings, 1 reply; 9+ messages in thread
From: Joe Buck @ 1999-02-27 19:07 UTC (permalink / raw)
  To: Paul Derbyshire; +Cc: egcs, egcs-bugs

> The following declaration gets a "parse error before '<'" that appears to
> be spurious:
> 
> static X &transform (const BinOp &op,
>                      X &x,
>                      typename math_traits<
>                        typename X::rebind<
>                          typename __ref_remover<
>                            typename BinOp::second_argument_type
>                          >::value_type
>                        >::other
>                      >::pass_type y) throw ();

You may well have found a bug, but without a complete program (where are
X, math_traits, rebind, etc defined?) no one will be able to debug the
problem.  Please resend with a complete program (preprocessor output
from the file you're trying to compile is one possibility).

> As you can see, all the aggressive "typename"ing in the world to qualify
> what template args are types doesn't prevent the error message.

The typename keyword will probably not make a difference in this case,
since this is not a template definition.




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1999-03-31 23:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-27 19:18 Suspected template parsing bug Bob Steagall
     [not found] ` < 3.0.3.32.19990227221538.009f30b0@pop.apk.net >
1999-02-27 21:43   ` Paul Derbyshire
1999-02-28 22:53     ` Paul Derbyshire
1999-03-01  9:02     ` Alexandre Oliva
1999-03-31 23:46       ` Alexandre Oliva
1999-02-28 22:53 ` Bob Steagall
1999-02-28 22:53 Paul Derbyshire
1999-02-27 19:07 ` Joe Buck
1999-02-28 22:53   ` Joe Buck

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).