shogo82148 / mecab

Unofficial fork of taku910/mecab (Yet another Japanese morphological analyzer)
https://shogo82148.github.io/mecab/
11 stars 1 forks source link

fix: warning: adding 'const char' to a string does not append to the … #26

Closed shogo82148 closed 4 years ago

shogo82148 commented 4 years ago

…string [-Wstring-plus-int]

https://github.com/shogo82148/mecab/runs/431774760?check_suite_focus=true#step:4:295

writer.cpp:255:61: warning: adding 'const char' to a string does not append to the string [-Wstring-plus-int]
            const std::string error = "unknown meta char: " + *p;
                                      ~~~~~~~~~~~~~~~~~~~~~~^~~~
writer.cpp:255:61: note: use array indexing to silence this warning
            const std::string error = "unknown meta char: " + *p;
                                                            ^
                                      &                     [   ]
shogo82148 commented 4 years ago

before:

$ mecab --node-format=%z
ほげ
libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc
Abort trap: 6

after:

$ ./src/mecab --node-format=%z
ほげ
unknown meta char: z