lundi 3 octobre 2016

Using GCC 6.2.x with CUDA 8.0 - Parameter pack expansion complaint

I'm trying to build some CUDA code using GCC 6.2.1 . This is code which builds fine with GCC 4.9.3 and both CUDA versions 7.5 and 8.0. When building the coda with GCC 6.2.1, I first encountered an issue discussed in

Using CUDA 8.0 with GCC 6.2.1 - bad function overloading complaint

which I resolved. I now encountered a second issue. getting the following compilation error:

/usr/include/c++/6.2.1/tuple:605:4: error: parameter packs not expanded with ‘...’:
                bool>::type=true>
    ^   
/usr/include/c++/6.2.1/tuple:605:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:616:4: error: parameter packs not expanded with ‘...’:
                bool>::type=false>
    ^    
/usr/include/c++/6.2.1/tuple:616:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:635:4: error: parameter packs not expanded with ‘...’:
         bool>::type=true>
    ^   
/usr/include/c++/6.2.1/tuple:635:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:648:4: error: parameter packs not expanded with ‘...’:
         bool>::type=false>
    ^    
/usr/include/c++/6.2.1/tuple:648:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:669:4: error: parameter packs not expanded with ‘...’:
         bool>::type=true>
    ^   
/usr/include/c++/6.2.1/tuple:669:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:681:4: error: parameter packs not expanded with ‘...’:
         bool>::type=false>
    ^    
/usr/include/c++/6.2.1/tuple:681:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:693:4: error: parameter packs not expanded with ‘...’:
         bool>::type=true>
    ^   
/usr/include/c++/6.2.1/tuple:693:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:704:4: error: parameter packs not expanded with ‘...’:
         bool>::type=false>
    ^    
/usr/include/c++/6.2.1/tuple:704:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:720:4: error: parameter packs not expanded with ‘...’:
                bool>::type=true>
    ^   
/usr/include/c++/6.2.1/tuple:720:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:731:4: error: parameter packs not expanded with ‘...’:
                bool>::type=false>
    ^    
/usr/include/c++/6.2.1/tuple:731:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:741:4: error: parameter packs not expanded with ‘...’:
         bool>::type=true>
    ^   
/usr/include/c++/6.2.1/tuple:741:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:752:4: error: parameter packs not expanded with ‘...’:
         bool>::type=false>
    ^    
/usr/include/c++/6.2.1/tuple:752:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:771:4: error: parameter packs not expanded with ‘...’:
         bool>::type=true>
    ^   
/usr/include/c++/6.2.1/tuple:771:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:783:4: error: parameter packs not expanded with ‘...’:
         bool>::type=false>
    ^    
/usr/include/c++/6.2.1/tuple:783:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:795:4: error: parameter packs not expanded with ‘...’:
         bool>::type=true>
    ^   
/usr/include/c++/6.2.1/tuple:795:4: note:         ‘_Elements’
/usr/include/c++/6.2.1/tuple:807:4: error: parameter packs not expanded with ‘...’:
         bool>::type=false>
    ^    
/usr/include/c++/6.2.1/tuple:807:4: note:         ‘_Elements’

Now, this is weird since it doesn't tell me which file and line of mine it's having trouble with.

Googling a bit, I found this piece code:

#include <iostream>

struct pass { 
    template<typename ...T> pass(T...) {}
};

template <typename... T>
void print(T... args) {
   pass{([&]{ std::cout << args << std::endl; }(), 1)...};
}

int main() { print(1, "2", 3.4, '5'); }

which compiles with clang 3.8 but not with GCC (4.9 or 6.2.1), with GCC giving the same error message. Maybe that's related somehow - although maybe not, since in GCC 4.9.3 you get the same error and still it compiles CUDA code just fine.

which

Aucun commentaire:

Enregistrer un commentaire