The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: ACarlotti on May 29, 2018, 07:28:07 AM

Title: Compile error with gcc8.1
Post by: ACarlotti on May 29, 2018, 07:28:07 AM
I just upgraded gcc to 8.1.0-1 from 7.3.1+20180406-1, and find that the code no longer compiles. The error is copied below. I have tested this on the latest versions of both Extended and Standard. The files involved haven't been modified recently (in particular, not since versions I have previously compiled). So it looks like a change in behaviour in gcc 8 such that our source is no longer valid (with current configuration).

I'm using Arch Linux. Version numbers as given by pacman. GCC 8.1.0 was released on Arch Linux on 2nd May, and this is the first 8.* release.


===> HOSTCXX bauer/fabrikbauer.cc
In file included from bauer/../simcity.h:16,
                 from bauer/fabrikbauer.cc:17:
bauer/../tpl/sparse_tpl.h: In member function 'koord& sparse_tpl<T>::get_size() const':
bauer/../tpl/sparse_tpl.h:60:11: error: binding reference of type 'koord&' to 'const koord' discards qualifiers
    return size;
[code]
Title: Re: Compile error with gcc8.1
Post by: Dwachs on May 29, 2018, 08:40:02 AM
changing the function in sparse_tpl.h line 60 to

const koord& get_size() const

I suspect this faulty declared function is never used, and only gcc8 complains.
Title: Re: Compile error with gcc8.1
Post by: An_dz on May 29, 2018, 07:24:17 PM
My fault, I saw that some days ago but had forgotten to commit that. By the way there are a lot of new warnings.