DaehwanKimLab / centrifuge

Classifier for metagenomic sequences
GNU General Public License v3.0
246 stars 73 forks source link

gcc on macos compilation error: "is not usable in a constant expression" #106

Closed tseemann closed 6 years ago

tseemann commented 6 years ago

Any ideas? Works on linux gcc, just not macos (might be version 7.x)

classifier.h:431:45: error: the value of 'rank' is not usable in a constant expression
                     while(_hitMap[i].rank < rank) {
                                             ^~~~
classifier.h:427:21: note: 'uint8_t rank' is not const
             uint8_t rank = 0;
                     ^~~~
classifier.h:431:45: error: type/value mismatch at argument 1 in template parameter list for 'template<class> struct std::rank'
                     while(_hitMap[i].rank < rank) {
                                             ^~~~
classifier.h:431:45: note:   expected a type, got 'rank'
fbreitwieser commented 6 years ago

Seems to be because of std::rank, which is new in C++-11. I'll submit a patch shortly.

Edit: I think it's a bug in g++ v7.2.0. Renaming a struct member from rank to _rank fixes the problem, though, so I'll apply that fix.