Skip to content

Fixed gcc c++17 error about field order in aggregate init#3

Merged
dallison merged 1 commit intodallison:mainfrom
mikael-s-persson:fix/gcc_build_error
Jan 9, 2024
Merged

Fixed gcc c++17 error about field order in aggregate init#3
dallison merged 1 commit intodallison:mainfrom
mikael-s-persson:fix/gcc_build_error

Conversation

@mikael-s-persson
Copy link
Copy Markdown
Contributor

Fixed gcc c++17 error about field order in aggregate init

Apparently, GCC doesn't like that the order of field initialization is not the same as the declaration order. See error below. This PR fixes that.

I also updated the version and sha's on the dependencies, bazel was erroring on that too. It might be related to the recent Bazel 7 update that breaks a lot of stuff it seems.

GCC error:

toolbelt/table.cc: In member function 'void toolbelt::Table::AddRow(std::vector<std::__cxx11::basic_string<char> >, toolbelt::Table::Color)':
toolbelt/table.cc:38:12: error: designator order for field 'toolbelt::Table::Cell::data' does not match declaration order in 'const toolbelt::Table::Cell'
   38 |     AddCell(index, {.color = color, .data = cell});
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@dallison
Copy link
Copy Markdown
Owner

dallison commented Jan 9, 2024

I think the standard says that in C++ the designated initializers must match declaration order. I wonder why clang didn't catch that one. It normally does. Thanks Mikael, I appreciate the bug fix.

@dallison dallison merged commit 5676e1a into dallison:main Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants