Compile fails using valarray on 3.4.0 but not 3.3.2

Steven T. Hatton hattons@globalsymmetry.com
Tue Apr 27 19:02:00 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 27 April 2004 01:22 pm, Volker Reichelt wrote:
Hi Volker,

> to make things short: GCC 3.4.0 is right, the code is wrong.
> (GCC 3.4.0 is just more standard conformant than 3.3.2.)
>
> In order to make the code compile you have to add something like
>
>   template<class> class Slice_iter;
>   template<class> class Cslice_iter;
[...]

I'm glad I chose the easy way to learn about templates in C++! :-/

> before the definition of "Slice_iter". That's because of [14.5.3]/2 in
> the standard. 

I guess that is ISO/IEC14882:1998?  I have the 2003 revision.  They look like 
they say the same thing after a quick reading. 

> The friend declarations in Slice_iter require that a 
> declaration of the template function for "operator==" etc. is already
> there.
>
>   template<class T> class Slice_iter {
>   // ...
> 	  friend bool operator==<>(const Slice_iter& p, const Slice_iter& q);
> 	  friend bool operator!=<>(const Slice_iter& p, const Slice_iter& q);
> 	  friend bool operator< <>(const Slice_iter& p, const Slice_iter& q);
>   };

Perhaps I should let Stroustrup know about this so he doesn't have any more 
unsuspecting victims. 

GCC remains bulletproof.  I've never encountered a problem with GCC that was 
due to a flaw in the product.  After 7 years of frequent use.

Regards,
Steven
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAjqbKwX61+IL0QsMRAkGbAJ9lKrfJtnubLa8FpExJRPpOdaAN7gCcDE2/
xeItIGkYlmMyAuf6jNcB3T0=
=4Aod
-----END PGP SIGNATURE-----



More information about the Gcc mailing list