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

std::tuple<> is not trivially constructible #41059

Closed
llvmbot opened this issue May 2, 2019 · 6 comments
Closed

std::tuple<> is not trivially constructible #41059

llvmbot opened this issue May 2, 2019 · 6 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented May 2, 2019

Bugzilla Link 41714
Resolution FIXED
Resolved on Jun 11, 2019 08:06
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor
CC @ldionne,@mclow
Fixed by commit(s) r363075

Extended Description

Clang -std=c++17 compiles the following if using libstdc++:

#include
static_assert(std::is_trivially_constructible_v<std::tuple<>>);

But adding -stdlib=libc++ causes

test.cc:3:1: error: static_assert failed due to requirement 'std::is_trivially_constructible_v<std::__1::tuple<>>

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 2, 2019

assigned to @ldionne

@mclow
Copy link
Contributor

mclow commented May 2, 2019

A few minutes of looking through the standard did not turn up any requirement that tuple<> be trivially constructible.

trivially destructible, yes.

4 If is_trivially_destructible_v is true for all Ti, then the destructor of tuple is trivial.

constexpr, yes.

The defaulted move and copy constructor of tuple<> shall be constexpr functions.

Can you tell me where you believe this requirement comes from?

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 3, 2019

I have no idea if the standard requires this, but it would be a nice to have extension if it doesn't. Specially considering that libstdc++ has it.

@mclow
Copy link
Contributor

mclow commented May 3, 2019

I have no idea if the standard requires this, but it would be a nice to have
extension if it doesn't. Specially considering that libstdc++ has it.

Generally speaking, I'm philosophically opposed to "things that everyone does, but aren't in the standard".

If this is a good thing, then we should write it into the standard.

@ldionne
Copy link
Member

ldionne commented May 29, 2019

I think it's a reasonable thing to do as a matter of QOI. The change is very simple, too, and it's the natural way to write that default constructor IMO.

Review here: https://reviews.llvm.org/D62618

@ldionne
Copy link
Member

ldionne commented Jun 11, 2019

Fixed in r363075.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

3 participants