Loki-Astari / ThorsMongo

C++ MongoDB API and BSON/JSON Serialization library
GNU General Public License v3.0
316 stars 72 forks source link

No compile enum with 8 and more element #63

Closed deevroman closed 4 years ago

deevroman commented 4 years ago
#include "../../external/ThorsSerializer/ThorSerialize/Traits.h"

enum TypeToken {
    KEYWORD, NAME, STRING,
    NUMBER, BEGIN_LINE, BEGIN_BLOCK, OPERATOR,
    ENDMARKER
};

ThorsAnvil_MakeEnum(TypeToken, KEYWORD, NAME, STRING,
                    NUMBER, BEGIN_LINE, BEGIN_BLOCK, OPERATOR, ENDMARKER);

int main() {
    return 0;
}

g++ --std=c++17 main.cpp

main.cpp:92:1: error: invalid digit '8' in octal constant
ThorsAnvil_MakeEnum(TypeToken, KEYWORD, NAME, STRING,
^
./../../external/ThorsSerializer/ThorSerialize/Traits.h:304:20: note: expanded from macro 'ThorsAnvil_MakeEnum'
            return NUM_ARGS(__VA_ARGS__, 1);                            \
                   ^
./../../external/ThorsSerializer/ThorSerialize/Traits.h:34:199: note: expanded from macro 'NUM_ARGS'
  ...40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 09, 08, 07, 06, 05, 04, 03, 02, 01, 00, Ignore)
                                                                                                                                      ^
1 error generated.

Environment:

Loki-Astari commented 4 years ago

That bug has already been found and fixed. Let me just look up the tag it was fixed with.

Did you install with brew? Easiest way to get the latest version is: brew upgrade thors-serializer

Loki-Astari commented 4 years ago

Yes fixed in pull request 58: https://github.com/Loki-Astari/ThorsSerializer/pull/58

Loki-Astari commented 4 years ago

PS. If you install via brew you don't need this header:

    #include "../../external/ThorsSerializer/ThorSerialize/Traits.h"

    // Can now simplify to:
    #include <ThorSerialize/Traits.h>
deevroman commented 4 years ago

Yeah, really, I had old sources. Installation via brew is not good for me because I need the project to be built on more than just mac os, and without installing anything on the system. Thank you for the answer.

Loki-Astari commented 4 years ago

Glad I could help. Is this s a public project I can look at? Love to look where it is being used.

deevroman commented 4 years ago

So far, it's a private project. It's a school project.