Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build with gcc 11 (ambiguous reference) #12

Closed
matthijskooijman opened this issue Mar 10, 2021 · 3 comments
Closed

Fails to build with gcc 11 (ambiguous reference) #12

matthijskooijman opened this issue Mar 10, 2021 · 3 comments

Comments

@matthijskooijman
Copy link
Contributor

@matthijskooijman matthijskooijman commented Mar 10, 2021

src/data.cpp: In function ‘void _myfread(FILE*, uchar*, uint, files, const char*, int)’:
src/data.cpp:1188:52: error: reference to ‘data’ is ambiguous
 1188 |                 IssueMessage(0,DATAFILE_ERROR,LOAD,data[file].name+NFORENUM_DIR_LEN,FILELINE,src,line);
      |                                                    ^~~~
In file included from /usr/include/c++/11/string:54,
                 from src/data.cpp:29:
/usr/include/c++/11/bits/range_access.h:318:5: note: candidates are: ‘template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)’
  318 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:309:5: note:                 ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])’
  309 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:299:5: note:                 ‘template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)’
  299 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:289:5: note:                 ‘template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)’
  289 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
src/data.cpp:1049:33: note:                 ‘const dat data [14]’
 1049 | #define DATA() static const dat data[]={
      |                                 ^~~~
src/data.h:37:1: note: in expansion of macro ‘DATA’
   37 | DATA()
      | ^~~~

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984158

I haven't looked closely, but at first glance it seems like the gcc/libstdc++ header files define a data() function or method that conflicts with a data variable. Maybe the gcc-defined version is new in gcc-11? It might be a matter of renaming our own data variable, or maybe there is a better fix.

@glx22
Copy link
Contributor

@glx22 glx22 commented Mar 10, 2021

Ah yes I have something for that in my cmake branch glx22@6f8fe85

@glx22
Copy link
Contributor

@glx22 glx22 commented Mar 10, 2021

Fixed with #10 I think.

@glx22 glx22 closed this Mar 10, 2021
@matthijskooijman
Copy link
Contributor Author

@matthijskooijman matthijskooijman commented Mar 11, 2021

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants