[antlr-interest] Static cast problem with hetero trees with gcc
Tiller, Michael (M.M.)
mtiller at ford.com
Thu Nov 13 13:51:23 PST 2003
I just installed cygwin (1.5.5-1) and now when I try to compile my parser
(generated with antlr-2.7.2) I get lots of errors regarding static casts.
The static casts are in the generated code and typically look something
like:
RefDeclNode tmp195_AST =
static_cast<RefDeclNode>(ANTLR_USE_NAMESPACE(antlr)nullAST);
The version of gcc (3.3.1) that comes with this version of cygwin gives me
an error message saying:
ModelicaParser.cpp:6781: error: invalid static_cast from type
`antlr::RefAST'
to type `ModParse::RefDeclNode'
Note that RefDeclNode (in the ModParse namespace) is defined as:
typedef antlr::ASTRefCount<DeclNode> RefDeclNode;
and DeclNode is defined as:
class BaseNode : public antlr::CommonAST { ... };
class DeclNode : public BaseNode { ... };
This worked with a previous version of gcc and is essentially what is
included in the ANTLR documentation as the appropriate approach for doing
heterogenous AST nodes in C++. Is anyone familiar with this problem? I
noticed it in some other code but managed to work around it. But since this
is generated, I'm kinda stuck.
--
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20031113/3cfd672a/attachment.html
More information about the antlr-interest
mailing list