- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having a bit of trouble with the following C++11 code fragment and icpc 15.0.0. This example is compiled correctly by g++ 4.9. I essentially have a templated vector class (with its scalar type T and size N being template arguments).
The variadically templated constructor that checks whether all the arguments are assignable to T& is not found. When I remove the assignable check (which I cannot do because otherwise an ambiguity occurs with the copy-constructor when N=1) the example compiles.
The manually expanded version for 2 arguments compiles. Any idea for a work-around.
// > icpc -v // icpc version 15.0.0 (gcc version 4.9.0 compatibility) // > icpc -std=c++11 i_dont_know_what_is_wrong_with_intel.cpp // i_dont_know_what_is_wrong_with_intel.cpp(39): error: no instance of constructor "Dummy<T, N>::Dummy [with T=double, N=2U]" matches the argument list // argument types are: (double, double) // Dummy<double, 2> t{1.0, 2.0}; // ^ // compilation aborted for i_dont_know_what_is_wrong_with_intel.cpp (code 2) #include <type_traits> template<typename ...T> struct All : std::true_type { }; template<typename Head, typename ...Tail> struct All<Head, Tail ...> : std::conditional<Head::value, All<Tail ...>, std::false_type>::type { }; template<typename T, unsigned N> struct Dummy { // this should work (and does in g++ 4.9), but doesn't template<typename ...Args, class = typename std::enable_if</*sizeof...(Args) == N && */ All< std::is_assignable<T&, Args> ... >::value >::type> explicit Dummy(const Args &...args) { } }; // this works template<typename T> struct DummyFixed2 { template<typename Arg1, typename Arg2, class = typename std::enable_if< All< std::is_assignable<T&, Arg1>, std::is_assignable<T&, Arg2>, >::value >::type> explicit DummyFixed2(const Arg1 &arg1, const Arg2 &arg2) { } }; int main(int argc, char const *argv[]) { DummyFixed2<double> f{1.0, 2.0}; Dummy<double, 2> t{1.0, 2.0}; /* code */ return 0; }
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Version 15.0.2 exhibits the same problem. I'm really stumped for a work-around... :(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Daniel,
I've filed this issue with the developers and will get back to you as soon as I've an update. Appreciate your patience till then.
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
verifique um provável upgrade para a Version 15.0.2 ou superior, com certeza vai resolver seu problema sem precisar codificar as regras que já existe.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI Cardin!
I've to find someone who can decipher your response! Thanks for the response and hopefully I should find out more on that.
BTW, this issue fails with ICC (with GNU >=4.7 which accepts) and is a bug that I've filed with the developers as mentioned earlier.
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This problem still exists with Intel 17.1 but works with GCC 6.2 and Clang 3.9.0. Is this going to be resolved soon?
Best,
Nils

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page