spirit icon indicating copy to clipboard operation
spirit copied to clipboard

c++20 deprecated "top-level comma expression in array subscript"

Open nickhuang99 opened this issue 3 years ago • 1 comments

https://github.com/boostorg/spirit/blob/32b40e9f82f90c00ebc86884c03c09bf2912009a/example/lex/word_count_lexer.cpp#L90 _= word [++ref(w), ref(c) += distance(_start, end)] https://github.com/boostorg/spirit/blob/32b40e9f82f90c00ebc86884c03c09bf2912009a/example/lex/word_count_lexer.cpp#L91 | eol [++ref(c), ++ref(l)]

c++20 deprecated "top-level comma expression in array subscript". A stackoverflow explains it very well (https://stackoverflow.com/a/63000331/3952939)

compiler: gcc-10.2.0 flag: -std=c++2a -Werror

suggested fix: adding parenthese for "comma" expression like following: = word [(++ref(w), ref(c) += distance(_start, _end))] | eol [(++ref(c), ++ref(l))]

nickhuang99 avatar May 12 '21 20:05 nickhuang99

Almost duplicate of #652. V2 docs/examples are not on my priority list. PR is welcome.

Kojoley avatar May 13 '21 16:05 Kojoley