bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/7] tests: fix invalid assignment when using variants in C++11


From: Akim Demaille
Subject: [PATCH 3/7] tests: fix invalid assignment when using variants in C++11
Date: Thu, 25 Jul 2013 18:28:13 +0200

* tests/c++.at (Exception safety): In variant mode $$ is an instance
of Object.  Assigning YY_NULL in C++98 is incorrect, but behaves ok,
as it assigns YY_NULL=0 using Object::operator= (char v).  It is wrong
in C++11 as there is operator for "$$ = nullptr".
---
 tests/c++.at | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/c++.at b/tests/c++.at
index 103a3f0..96f2ac1 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -795,11 +795,11 @@ item:
 // Not just 'E', otherwise we reduce when 'E' is the lookahead, and
 // then the stack is emptied, defeating the point of the test.
 | 'E' 'a' { YYUSE($][1); $][$ = $][2; }
-| 'R'     { $][$ = YY_NULL; ]AT_VARIANT_IF([], [delete $][1]; )[YYERROR; }
+| 'R'     { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYERROR; }
 | 'p'     { $][$ = $][1; }
 | 's'     { $][$ = $][1; throw std::runtime_error ("reduction"); }
-| 'T'     { $][$ = YY_NULL; ]AT_VARIANT_IF([], [delete $][1]; )[YYABORT; }
-| error   { $][$ = YY_NULL; yyerrok; }
+| 'T'     { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYABORT; }
+| error   { ]AT_VARIANT_IF([], [$][$ = YY_NULL; ])[yyerrok; }
 ;
 %%
 
-- 
1.8.3.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]