[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#470850: g++-4.3: Regression in template specialization



Package: g++-4.3
Version: 4.3.0-1
Severity: normal

  The following code has three specializations of a template.
The third one compiles with g++-4.2 but gives an error with g++-4.3 :

vdanjean@cayuga:/tmp/toto$ g++-4.3 -Wall -c test.cpp 
test.cpp:30: error: template parameters not used in partial specialization:
test.cpp:30: error:         ‘T’
test.cpp:30: error:         ‘A’
vdanjean@cayuga:/tmp/toto$

It seems to me that my code is correct and g++-4.3 wrong: I really use T
and A in the partial specialization.

Do you agree on this bug or is it a wrong partial specialization ?

  Best regards,
    Vincent

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.3 depends on:
ii  gcc-4.3                   4.3.0-1        The GNU C compiler
ii  gcc-4.3-base              4.3.0-1        The GNU Compiler Collection (base 
ii  libc6                     2.7-9          GNU C Library: Shared libraries
ii  libgmp3c2                 2:4.2.2+dfsg-2 Multiprecision arithmetic library
ii  libmpfr1ldbl              2.3.1.dfsg.1-2 multiple precision floating-point 
ii  libstdc++6-4.3-dev        4.3.0-1        The GNU Standard C++ Library v3 (d

g++-4.3 recommends no packages.

-- no debconf information
#include <vector>

template<class NativeIterator> struct remote_trait;

/**
 * specialization of remote_trait for pointers
 */
template<class T>
struct remote_trait<T*> {

  typedef T         value_type;         ///< type of internal value
  typedef size_t difference_type;    ///< type of the difference between two iterators
  typedef T*        pointer;            ///< type of a pointer to the value
  typedef T&        reference;          ///< type of a reference to the value

  static pointer convert_to_pointer( T* it ) { return it; }
};

template<class T, class A>
struct remote_trait< typename std::vector<T,A> > {
  typedef const T   value_type;       ///< type of internal value
  typedef size_t difference_type;  ///< type of the difference between tw
  typedef const T*  pointer;          ///< type of a pointer to the value
  typedef const T&  reference;        ///< type of a reference to the value

  static pointer convert_to_pointer( const T* it ) { return &*it; }
};

template<class T, class A>
struct remote_trait< typename std::vector<T,A>::iterator > {
  typedef const T   value_type;       ///< type of internal value
  typedef size_t difference_type;  ///< type of the difference between tw
  typedef const T*  pointer;          ///< type of a pointer to the value
  typedef const T&  reference;        ///< type of a reference to the value

  static pointer convert_to_pointer( const T* it ) { return &*it; }
};


Reply to: