-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Wondering if the definition of friend template functions as in
Line 85 in 765a1ee
| template <class T> |
doesn't implies a double definition.
clang 4.0.0 works ,but I'm getting in my implementation while compiling with gcc-6.1 the following
../include/experimental/fundamental/v3/bits/bit_pointer.hpp : dans l'instantiation de ‘class std::experimental::fundamental_v3::bit_pointer<short unsigned int>’ :
../include/experimental/fundamental/v3/bits/bit_iterator.hpp:51:79: required from ‘class std::experimental::fundamental_v3::bit_iterator<std::_List_iterator<short unsigned int> >’
../example/bits/bit.cpp:104:94: required from here
../include/experimental/fundamental/v3/bits/bit_pointer.hpp:187:40: erreur: redefinition of ‘template<class T> constexpr std::experimental::fundamental_v3::bit_pointer<WordType> std::experimental::fundamental_v3::operator+(typename std::experimental::fundamental_v3::bit_pointer<WordType>::difference_type, std::experimental::fundamental_v3::bit_pointer<WordType>)’
friend constexpr bit_pointer<T> operator+(
^
../include/experimental/fundamental/v3/bits/bit_pointer.hpp:187:40: note: ‘template<class T> constexpr std::experimental::fundamental_v3::bit_pointer<WordType> std::experimental::fundamental_v3::operator+(typename std::experimental::fundamental_v3::bit_pointer<WordType>::difference_type, std::experimental::fundamental_v3::bit_pointer<WordType>)’ previously defined here
../include/experimental/fundamental/v3/bits/bit_pointer.hpp:198:15: erreur: redefinition of ‘template<class T, class U> constexpr typename std::common_type<typename std::experimental::fundamental_v3::bit_pointer<WordType>::difference_type, typename std::experimental::fundamental_v3::bit_pointer<U>::difference_type>::type std::experimental::fundamental_v3::operator-(std::experimental::fundamental_v3::bit_pointer<WordType>, std::experimental::fundamental_v3::bit_pointer<U>)’
Is this a bug in clang/gcc?
Why the following is not enough?
friend constexpr bit_pointer operator+(
difference_type n,
bit_pointer x
)
IMHO the constructor takes care already of the valid conversions, so even the mixed comparison should work directly with bit_pointer without needed bit_pointer<T> and bit_pointer<U>.
Metadata
Metadata
Assignees
Labels
No labels