c++ - Variadic template metaprogramming : a bug in clang++ or g++? -


consider variadic template madness cast array 1 type another:

#include <array> #include <type_traits>  template <typename type> class converter {     public:         template <typename othertype, unsigned int othersize, class array, typename... types, class = typename std::enable_if<sizeof...(types) != othersize>::type>          static constexpr const std::array<othertype, othersize> convert(const array source, const types&... values);         template <typename othertype, unsigned int othersize, class array, typename... types, class = typename std::enable_if<sizeof...(types) == othersize>::type>          static constexpr const std::array<othertype, othersize> convert(const array, const types... values); };  template <typename type> template <typename othertype, unsigned int othersize, class array, typename... types, class>  constexpr const std::array<othertype, othersize> converter<type>::convert(const array source, const types&... values) {     return convert<othertype, othersize>(source, values..., othertype(source[sizeof...(values)])); }  template <typename type> template <typename othertype, unsigned int othersize, class array, typename... types, class>  constexpr const std::array<othertype, othersize> converter<type>::convert(const array, const types... values) {     return std::array<othertype, othersize>({{values...}}); }  int main(int argc, char* argv[]) {     converter<double>::convert<int, 3>(std::array<double, 3>({{1., 2., 3.}}));     return 0; } 

this code compiles under g++4.7 , g++4.8 not under clang++3.2 :

main.cpp:16:67: error: conflicting types 'convert' constexpr const std::array<othertype, othersize> converter<type>::convert(const array source, const types&... values)                                                                   ^ main.cpp:9:65: note: previous declaration here         static constexpr const std::array<othertype, othersize> convert(const array source, const types&... values);                                                                 ^ main.cpp:23:67: error: conflicting types 'convert' constexpr const std::array<othertype, othersize> converter<type>::convert(const array, const types... values)                                                                   ^ main.cpp:11:65: note: previous declaration here         static constexpr const std::array<othertype, othersize> convert(const array, const types... values); 

is g++ permissive or bug in clang++ (and if so, there public bugtracker of clang++) ?

yeah, this bug reported in clang , fixed.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -