Loki-Astari / ThorsMongo

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

Issue with ALT_REP_OF_NN in traits.h #48

Closed danielaparker closed 5 years ago

danielaparker commented 5 years ago

I haven't actually used this software, but inspecting traits.h, it looks to me that the TEMPLATE macros won't work for more than 1 template parameter. You have on master

#define ALT_REP_OF_10(Act, E, P, S)     P ALT_EXPAND(Act, E, 10), ALT_REP_OF_09(Act, E,  , S)
#define ALT_REP_OF_9(Act, E, P, S)      P ALT_EXPAND(Act, E, 9), ALT_REP_OF_08(Act, E,  , S)
#define ALT_REP_OF_8(Act, E, P, S)      P ALT_EXPAND(Act, E, 8), ALT_REP_OF_07(Act, E,  , S)
#define ALT_REP_OF_7(Act, E, P, S)      P ALT_EXPAND(Act, E, 7), ALT_REP_OF_06(Act, E,  , S)
#define ALT_REP_OF_6(Act, E, P, S)      P ALT_EXPAND(Act, E, 6), ALT_REP_OF_05(Act, E,  , S)
#define ALT_REP_OF_5(Act, E, P, S)      P ALT_EXPAND(Act, E, 5), ALT_REP_OF_04(Act, E,  , S)
#define ALT_REP_OF_4(Act, E, P, S)      P ALT_EXPAND(Act, E, 4), ALT_REP_OF_03(Act, E,  , S)
#define ALT_REP_OF_3(Act, E, P, S)      P ALT_EXPAND(Act, E, 3), ALT_REP_OF_02(Act, E,  , S)
#define ALT_REP_OF_2(Act, E, P, S)      P ALT_EXPAND(Act, E, 2), ALT_REP_OF_01(Act, E,  , S)
#define ALT_REP_OF_1(Act, E, P, S)      P ALT_EXPAND(Act, E, 1) S

I believe that should be

#define ALT_REP_OF_10(Act, E, P, S)     P ALT_EXPAND(Act, E, 10), ALT_REP_OF_9(Act, E,  , S)
#define ALT_REP_OF_9(Act, E, P, S)      P ALT_EXPAND(Act, E, 9), ALT_REP_OF_8(Act, E,  , S)
#define ALT_REP_OF_8(Act, E, P, S)      P ALT_EXPAND(Act, E, 8), ALT_REP_OF_7(Act, E,  , S)
#define ALT_REP_OF_7(Act, E, P, S)      P ALT_EXPAND(Act, E, 7), ALT_REP_OF_6(Act, E,  , S)
#define ALT_REP_OF_6(Act, E, P, S)      P ALT_EXPAND(Act, E, 6), ALT_REP_OF_5(Act, E,  , S)
#define ALT_REP_OF_5(Act, E, P, S)      P ALT_EXPAND(Act, E, 5), ALT_REP_OF_4(Act, E,  , S)
#define ALT_REP_OF_4(Act, E, P, S)      P ALT_EXPAND(Act, E, 4), ALT_REP_OF_3(Act, E,  , S)
#define ALT_REP_OF_3(Act, E, P, S)      P ALT_EXPAND(Act, E, 3), ALT_REP_OF_2(Act, E,  , S)
#define ALT_REP_OF_2(Act, E, P, S)      P ALT_EXPAND(Act, E, 2), ALT_REP_OF_1(Act, E,  , S)
#define ALT_REP_OF_1(Act, E, P, S)      P ALT_EXPAND(Act, E, 1) S

Best regards, Daniel

Loki-Astari commented 5 years ago

Code fixed in: https://github.com/Loki-Astari/ThorsSerializer/commit/d2496003c58701ea01f4ebfbb4acff084cc170a6 Submitted for build in homebrew: https://github.com/Homebrew/homebrew-core/pull/41654