We should be clear in the doc: YY_ macros are private, do not depend on them.
commit 602f8e2a77e008bbf4a90213b6abfbb52265ff48 Author: Akim Demaille <[email protected]> Date: Thu Oct 18 17:37:18 2018 +0200 c++: do not exhibit private macros * examples/variant-11.yy: here. diff --git a/examples/variant-11.yy b/examples/variant-11.yy index 660b2009..ba01c6c4 100644 --- a/examples/variant-11.yy +++ b/examples/variant-11.yy @@ -125,7 +125,7 @@ namespace yy yylex () { static auto count = 0u; - auto stage = count; + const auto stage = count; ++count; auto loc = parser::location_type{nullptr, stage + 1, stage + 1}; if (stage == 0) @@ -150,7 +150,7 @@ int main (int argc, const char *argv[]) { if (2 <= argc && isdigit (*argv[1])) - max = strtol (argv[1], YY_NULLPTR, 10); + max = strtol (argv[1], nullptr, 10); auto&& p = yy::parser{}; p.set_debug_level (!!getenv ("YYDEBUG")); return p.parse (); diff --git a/examples/variant.yy b/examples/variant.yy index b440fa6b..2938c50c 100644 --- a/examples/variant.yy +++ b/examples/variant.yy @@ -97,6 +97,11 @@ item: namespace yy { + // Use nullptr with pre-C++11. +#if defined __cplusplus && __cplusplus < 201103L +# define nullptr 0 +#endif + // The yylex function providing subsequent tokens: // TEXT "I have three numbers for you." // NUMBER 1 @@ -111,7 +116,7 @@ namespace yy { static int stage = -1; ++stage; - parser::location_type loc (YY_NULLPTR, stage + 1, stage + 1); + parser::location_type loc (nullptr, stage + 1, stage + 1); switch (stage) { case 0:
