FS#6575 - cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'

Attached to Project: OpenTTD
Opened by kencu (kencu) - Sunday, 18 June 2017, 04:51 GMT
Last edited by frosch (frosch) - Thursday, 22 June 2017, 17:30 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System Mac OS X
Severity Medium
Priority Normal
Reported Version 1.7.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Newer compilers (this was found while using clang-3.9 on MacOSX) raise the following line of code to an error.

char *app_bundle = strchr(exe, '.');

This was found here:


The fix appears to be a simple cast:

char *app_bundle = (char *)strchr(exe, '.');

Which allows the compile to succeed.
This task depends upon

Closed by  frosch (frosch)
Thursday, 22 June 2017, 17:30 GMT
Reason for closing:  Fixed
Additional comments about closing:  in r27886
Comment by frosch (frosch) - Sunday, 18 June 2017, 20:55 GMT
I would think the reverse it true.
All const_casts in ChangeWorkingDirectoryToExecutable are invalid. "exe" is not supposed to be modified, but line 1044 does.