nneonneo / 2048-ai

AI for the 2048 game
MIT License
1.09k stars 279 forks source link

fix error: non-constant-expression narrowing #38

Closed jtrinklein closed 9 years ago

jtrinklein commented 9 years ago

compiling on OSX 10.9 results in a compile error.

error reported by g++:

2048.cpp:355:38: error: non-constant-expression cannot be narrowed from type 'int' to 'uint8_t'
      (aka 'unsigned char') in initializer list [-Wc++11-narrowing]
        trans_table_entry_t entry = {state.curdepth, res};
                                     ^~~~~~~~~~~~~~
2048.cpp:355:38: note: override this message by inserting an explicit cast
        trans_table_entry_t entry = {state.curdepth, res};
                                     ^~~~~~~~~~~~~~
                                     static_cast<uint8_t>( )

g++ --version output:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
nneonneo commented 9 years ago

37 just fixed this - please update. Thanks for submitting this pull request!