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

fix clang 8.0.x compilation error #2291

Closed
wants to merge 1 commit into from

Conversation

sergiud
Copy link
Contributor

@sergiud sergiud commented May 18, 2021

With a clang 8.0.x based toolchain, the compiler insists that the constexpr value must be default initialized.

@@ -391,7 +391,7 @@ struct ostream_params {
};
} // namespace detail

static constexpr detail::buffer_size buffer_size;
static constexpr detail::buffer_size buffer_size{};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a short comment clarifying that {} is a workaround for gcc 8, preferably with a link to the bug report.

@sergiud sergiud marked this pull request as draft May 18, 2021 18:26
@vitaut
Copy link
Contributor

vitaut commented May 28, 2021

I wasn't able to repro the issue (https://godbolt.org/z/P99s1q6vf) so closing for now. Feel free to reopen with more details.

@vitaut vitaut closed this May 28, 2021
@sergiud
Copy link
Contributor Author

sergiud commented May 28, 2021

That's fine. It may be our specific combination of clang and musl responsible for this.

@mathstuf
Copy link

mathstuf commented Aug 6, 2021

I'm not seeing it with clang 8.x on Godbolt either, but it was observed with some older Xcode deployments at least. Godbolt doesn't provide those (and the Xcode toolchain versions don't match to any specific upstream clang releases either).

@seanm
Copy link
Contributor

seanm commented Aug 6, 2021

You can see the error here for example: https://open.cdash.org/viewBuildError.php?buildid=7385287

/Users/builder/external/VTK/ThirdParty/fmt/vtkfmt/vtkfmt/os.h:397:31: error: default initialization of an object of const type 'const detail::buffer_size' without a user-provided default constructor
constexpr detail::buffer_size buffer_size;
                              ^
                                         {}

It reproduces with both macOS 10.11 + Xcode 8.2.1 (8C1002) and macOS 10.10 + Xcode 7.2.1 (7C1002). Those are the newest Xcodes possible for those versions of macOS.

I've confirmed adding the {} fixes the issue. And there are no other compiler errors after that.

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.

4 participants