-
-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange compile error related to length of string sent to sol::table.get<T> #1535
Comments
I think this may be caused by a GCC bug. It looks like the GCC static analyzer is seeing that somewhere the function gets called with a null-terminated string of a certain length (30 in my case, I guess 10 with the null terminator in yours), and reads the whole thing, and assumes it will always read that many bytes. @FranchescaMullin is there somewhere else in your program where you have a nine-character argument to |
You are definitely on to something! My first call to get is the following (10 characters long): As an experiment to test your theory, I tried to compile it with the field name lengthened to 17 chars: If I drop the number of chars in the first call to get to 16 chars, the whole thing compiles fine. |
Seems like the same problem from #1394. It's a warning, but compiling with
The Key template argument goes from |
Hi, thanks for making a great library. I am a bit puzzled by a strange compile error I am getting right now. Not sure if I am doing something silly or if this is really a bug?
Here are some details:
config
is of typeconst sol::table& config
and is passed to the example code as a parameter in a methodThis compiles fine:
sol::optional<std::string> currency = config.get<sol::optional<std::string>>("currencyyyyyy");
But this line gives a compile error:
sol::optional<std::string> currency = config.get<sol::optional<std::string>>("currency");
I played around, and basically the field name passed to .get must be > 9 chars or it will not compile.
Example error:
Include Compiler/IDE (Visual Studio, XCode...), Build and Deployment System, Language (C++, Objective-C++), and any special defines you have set:
The text was updated successfully, but these errors were encountered: