bug-bison
[Top][All Lists]
Advanced

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

Assertion `!yytname_' failed.


From: Antonio Correia
Subject: Assertion `!yytname_' failed.
Date: Mon, 3 Feb 2014 05:40:01 -0800 (PST)

Hi all, 

I was testing error recovery with bison and I'm getting this assertion here: 


/// Instantiate an empty \a T in here. 
template <typename T> 
T& 
build () 
{ 
YYASSERT (!yytname_); 
YYASSERT (sizeof (T) <= S); 
yytname_ = typeid (T).name (); 
return *new (yyas_<T> ()) T; 
} 

when using this simple grammar. 


%token <char> CHAR "char" 
%token <int> NUM "number" 
%token SEMICOLON ";" 
%token END 0 "end of file" 

%% 


stms : stms CHAR ";" 
| CHAR ";" 
| error ";" {yyerrok;} 
; 

%% 


I've used bison 3.0.2 and flex 2.5.37. 
I'm attaching all the code I used with this test. 

I was expecting two syntax error messages, and in fact I get those messages 
when I remove the parse.assert definition. 

I used g++ *.cpp -o test to compile the code, after bison and flex steps. 


Cheers, 
Antonio

Attachment: assert_error.zip
Description: Binary data


reply via email to

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