The International Simutrans Forum

 

Author Topic: Compile error with gcc8.1  (Read 287 times)

0 Members and 1 Guest are viewing this topic.

Offline ACarlotti

  • *
  • Posts: 405
Compile error with gcc8.1
« 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.

Code: [Select]
===> 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]

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4564
  • Languages: EN, DE, AT
Re: Compile error with gcc8.1
« Reply #1 on: May 29, 2018, 08:40:02 AM »
changing the function in sparse_tpl.h line 60 to
Code: [Select]
const koord& get_size() const
I suspect this faulty declared function is never used, and only gcc8 complains.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2839
  • D'oh
    • by An_dz
  • Languages: pt, en, it, (de)
Re: Compile error with gcc8.1
« Reply #2 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.