Skip to content

[Bug] Builds using GCC 16.0.1 fail on u8string() usage #2866

@oznogon

Description

@oznogon

Fedora 44 updates the GNU toolchain from gcc 15.2 to gcc 16.0.1. This causes build failures on master using F44 citing no known conversion for argument 1 from ‘std::u8string’, when it builds without issue on F43.

/home/username/git/daid/emptyepsilon-compile/EmptyEpsilon/src/packResourceProvider.cpp:95:87: error: no matching function for call to ‘string::string(<brace-enclosed initializer list>)’
   95 |             if (!entry.is_directory() && string { entry.path().extension().u8string() }.lower() == ".pack")
      |                                                                                       ^
  • there are 11 candidates
In file included from /home/username/git/daid/emptyepsilon-compile/SeriousProton/src/resources.h:4,
                 from /home/username/git/daid/emptyepsilon-compile/EmptyEpsilon/src/packResourceProvider.h:4,
                 from /home/username/git/daid/emptyepsilon-compile/EmptyEpsilon/src/packResourceProvider.cpp:1:
    • candidate 1: ‘string::string(float, int)’
      /home/username/git/daid/emptyepsilon-compile/SeriousProton/src/stringImproved.h:47:5:
         47 |     string(const float nr, int decimals = 2) : std::string()
            |     ^~~~~~
      • no known conversion for argument 1 from ‘std::u8string’ {aka ‘std::__cxx11::basic_string<char8_t>’} to ‘float’
        /home/username/git/daid/emptyepsilon-compile/SeriousProton/src/stringImproved.h:47:24:
           47 |     string(const float nr, int decimals = 2) : std::string()
              |            ~~~~~~~~~~~~^~
    • candidate 2: ‘string::string(unsigned int)’
      /home/username/git/daid/emptyepsilon-compile/SeriousProton/src/stringImproved.h:40:5:
         40 |     string(const unsigned int nr) : std::string()
            |     ^~~~~~
      • no known conversion for argument 1 from ‘std::u8string’ {aka ‘std::__cxx11::basic_string<char8_t>’} to ‘unsigned int’
        /home/username/git/daid/emptyepsilon-compile/SeriousProton/src/stringImproved.h:40:31:
           40 |     string(const unsigned int nr) : std::string()
              |            ~~~~~~~~~~~~~~~~~~~^~
...

This appears to be related to C++20 changes: ToruNiina/toml11#104

GCC 16 changes the default language version from gnu++17 to gnu++20.

  • Replacing u8string() and generic_u8string() calls with string() and generic_string() in EmptyEpsilon packResourceProvider.cpp and SeriousProton resources.cpp silences the errors, but it's unclear if those changes would affect cross-platform compatibility.
  • Specifying -std=gnu++17 via CMake target_compile_options in both EmptyEpsilon and SeriousProton also silences the errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions