Compile Time Parser Generator is a C++ single header library which takes a language description as a C++ code and turns it into a LR1 table parser with a deterministic finite automaton lexical analyzer, all in compile time.
MIT License
460
stars
24
forks
source link
Invoking undefined behaviour when using an rvalue in the constructor of stdex::cvector #7
This is my first pull request :fireworks:, so yeah..., but here you're invoking an undefined behaviour(for count larger then 1) by moving an rvalue into the emplace_back function count times. It'd be fine if you were to move only once, but because you're moving it more than once you can't really expect any other element after the first to be in the valid state inside the _thedata member field.
This is my first pull request :fireworks:, so yeah..., but here you're invoking an undefined behaviour(for count larger then 1) by moving an rvalue into the
emplace_back
function count times. It'd be fine if you were to move only once, but because you're moving it more than once you can't really expect any other element after the first to be in the valid state inside the _thedata member field.https://github.com/peter-winter/ctpg/blob/99af8d2f712a3bfdfbe37d858fac391da2c78240/ctpg.hpp#L114-L119