-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
static cast a derived class to base class with defined type case operators #37949
Comments
assigned to @ldionne |
This happens because libc++ (as an extension) permits a std::tuple<int, int> to be constructed from a single int, with the second int being default-constructed. static_cast(d) in this case performs the same initialization as Base b(d); ... which can choose either the tuple copy/move constructor, or the undersized tuple constructor from tuple elements. The former requires a derived-to-base conversion on d, but the latter has 'exact match' rank because the construct-from-elements constructor employs perfect forwarding (the user-defined conversion to int happens inside the constructor, not as part of the call). So this is a libc++ bug: this is a case where its undersized tuple constructor is non-conforming. |
I'm sick and tired of our tuple extensions :( I wish we could just ship a strictly conforming std::tuple -- it's already hard enough. |
Lets go ahead and remove them then. I can write a paper later proposing them so we can provide them while being standards conforming. |
Do you mean remove-remove, or remove but keep the ability to enable like it has been done for the implicit-constructor-with-reduced-arity extension? |
I think remove remove, I don't know if anyone actually re-enables the extension. |
Remove and see what breaks :-( |
Fixed by commit a3ab512
|
Extended Description
#include
#include
using Base = std::tuple<int,int>;
struct Derived : Base {
};
int main() {
}
The text was updated successfully, but these errors were encountered: