incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] /include/vector
Date Mon, 27 Nov 2006 20:55:03 GMT
Farid Zaripov wrote:
>   If #defined _RWSTD_NO_CLASS_PARTIAL_SPEC macro, class vector<bool> is 
> not a template class and typename keyword shouldn't be used within class 
> definition. Using of the _VB_TYPENAME macro doesn't help because of 
> _RWSTD_REBIND macro uses _TYPENAME macro explicitly.

Out of curiosity, how did you run into this?

I can reproduce the error whith EDG eccp but only when I #define
the macro on the command line:

eccp -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG 
-D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include 
-I/build/sebor/eccp-3.8-11s/include -D_RWSTD_NO_CLASS_PARTIAL_SPEC -A -x 
--template_directory=/build/sebor/eccp-3.8-11s/lib -g 
--display_error_number --remarks --diag_suppress 
193,236,340,401,261,479,487,678,679,815 
/build/sebor/dev/stdlib/src/export.cpp
"/build/sebor/dev/stdlib/include/vector", line 761: error #761-D: 
typename may
           only be used within a template
       typedef _RWSTD_REBIND(_Allocator, unsigned int) 
_C_value_alloc_type;
               ^

"/build/sebor/dev/stdlib/include/vector", line 761: error #1139-D: the
           "template" keyword used for syntactic disambiguation may only be
           used within a template
       typedef _RWSTD_REBIND(_Allocator, unsigned int) 
_C_value_alloc_type;
               ^

2 errors detected in the compilation of 
"/build/sebor/dev/stdlib/src/export.cpp".

> 
>   The proposed patch is attached.

Okay.

Thanks.
Martin

> 
>   ChangeLog:
>   * vector (vector<bool, _Allocator >): Removed _VB_TYPENAME macro.
>   [_RWSTD_NO_CLASS_PARTIAL_SPEC && !_RWSTD_NO_TYPENAME]: _TYPENAME
>   cleared before types definitions and restored after.
> 
> Farid.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: vector
> ===================================================================
> --- vector	(revision 478181)
> +++ vector	(working copy)
> @@ -729,16 +729,12 @@
>  
>  #ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
>  
> -#  define _VB_TYPENAME   _TYPENAME
> -
>  _EXPORT
>  template <class _Allocator>
>  class
>  
>  #else   // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
>  
> -#  define _VB_TYPENAME
> -
>       // use a macro to mutate _Allocator into allocator<bool>
>  # define _Allocator allocator<bool>
>  
> @@ -749,6 +745,12 @@
>  
>  vector<bool, _Allocator >: private _Allocator
>  {
> +#if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) && !defined (_RWSTD_NO_TYPENAME)
> +    // clear _TYPENAME
> +#  undef _TYPENAME
> +#  define _TYPENAME
> +#endif  // _RWSTD_NO_CLASS_PARTIAL_SPEC && !_RWSTD_NO_TYPENAME
> +
>      typedef _RWSTD_REBIND(_Allocator, unsigned int)       _C_value_alloc_type;
>      typedef vector                                        _C_self;
>  public:
> @@ -756,11 +758,17 @@
>      typedef _Allocator                                      allocator_type;
>      typedef bool                                            value_type;
>  
> -    typedef _VB_TYPENAME allocator_type::size_type          size_type;
> -    typedef _VB_TYPENAME allocator_type::difference_type    difference_type;
> -    typedef _VB_TYPENAME _C_value_alloc_type::pointer       pointer;
> -    typedef _VB_TYPENAME _C_value_alloc_type::const_pointer const_pointer;
> +    typedef _TYPENAME allocator_type::size_type             size_type;
> +    typedef _TYPENAME allocator_type::difference_type       difference_type;
> +    typedef _TYPENAME _C_value_alloc_type::pointer          pointer;
> +    typedef _TYPENAME _C_value_alloc_type::const_pointer    const_pointer;
>  
> +#if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) && !defined (_RWSTD_NO_TYPENAME)
> +    // restore _TYPENAME
> +#  undef _TYPENAME
> +#  define _TYPENAME   typename
> +#endif  // _RWSTD_NO_CLASS_PARTIAL_SPEC && !_RWSTD_NO_TYPENAME
> +
>      class iterator;
>      class const_iterator;
>  


Mime
View raw message