take-cheeze / mruby-marshal

mruby implementation of cruby marshaling.
12 stars 9 forks source link

Compile-time error when building with Clang 13 #41

Open suetanvil opened 1 year ago

suetanvil commented 1 year ago

When compiling using Clang 13 (macOS, XCode), the compile fails with the error message:

marshal.cpp:310:38: error: expected '(' for function-style cast or type construction auto meta = hash_marshal_meta{*this, limit};

hash_marshal_meta is a simple two-element struct.

What I think is happening is that Clang used to interpret the RHS as a C11-style struct initializer, a feature that isn't part of C++ but something that Clang supported as an extension. However, C++11 (IIRC) supports brace-style constructor arguments and as Clang supports more modern features, it's had to drop that particular fallback behaviour.

In any case, the right thing to do is just use a more traditional initialization syntax, which is what I have done. A pull request is on its way.