Bug 67019 - Unable to build with gcc 3.3.1
Summary: Unable to build with gcc 3.3.1
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: git master
Platform: Mandrake RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-01 22:35 UTC by Chris Thompson
Modified: 2003-11-02 04:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch to convert C++-style casts to C-style casts (68.99 KB, patch)
2003-11-01 22:37 UTC, Chris Thompson
Details

Note You need to log in before you can comment on or make changes to this bug.
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.