Bug 67019

Summary: Unable to build with gcc 3.3.1
Product: [Applications] kdevelop Reporter: Chris Thompson <chris>
Component: generalAssignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Mandrake RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch to convert C++-style casts to C-style casts

Description Chris Thompson 2003-11-01 22:35:34 UTC
Version:           CVS (using KDE KDE 3.1.3)
Installed from:    Mandrake RPMs
Compiler:          gcc 3.3.1 Default with Mandrake 9.2
OS:          Linux

I am unable to compile KDevelop from cvs.  I reported this to the mailing list several days ago and got confirmation but no help.  I get hundreds of errors compiling the AdaParser.cpp file in languages/ada.  These are all along the lines of:

AdaParser.cpp:34: error: invalid static_cast from type `antlr::RefAST' to type `RefAdaAST'

I get similar error messages in other files, including files dealing with the Pascal language.  The problem seems to stem from the static cast from ASTRefCount<AST> to ASTRefCount<AdaAST> which is, I believe, not allowed under C++ standards.  I could be wrong on that.  Gcc 3.3.x has better support for C++ than 3.2 does which is why this error does not appear with an older version of the compiler.  I will attach a patch which uses C-style casts instead of C++-style casts which at least makes the code compile.  HOWEVER, I believe the cast is invalid and therefore the results (either with the patch or, with an older version of gcc, without the patch) are undefined.
Comment 1 Chris Thompson 2003-11-01 22:37:19 UTC
Created attachment 2971 [details]
Patch to convert C++-style casts to C-style casts

This allows the code to compile under gcc 3.3.1.
Comment 2 Jens Dagerbo 2003-11-02 00:03:54 UTC
I haven't looked at the code yet, but reinterpret_cast is probably preferable (if really needed) as it can be much easier grepped for later.
Comment 3 Chris Thompson 2003-11-02 02:37:58 UTC
I agree that reinterpret_cast would generally be better but it does not work (compiler error) in this case.  I am not at all convinced that you can cast templates this way.  I don't have any documentation to back this up at this time, though, so I could easily be wrong.
Comment 4 Dirk Mueller 2003-11-02 04:48:56 UTC
compilation has been fixed in CVS.