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

shape allows construction from incompatible shapes (std::is_constructible and std::is_assignable are broken for std::tuple on various STLs) #20

Open
dsharlet opened this issue Jul 4, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@dsharlet
Copy link
Owner

dsharlet commented Jul 4, 2020

Some compilers have a broken implementation of std::is_constructible<std::tuple<...>, std::tuple<...>>, which makes it hard to prevent shapes from being constructed/assigned from incompatible shapes.

@dsharlet dsharlet added the bug Something isn't working label Jul 6, 2020
dsharlet added a commit that referenced this issue Jul 13, 2020
@dsharlet dsharlet reopened this Jul 13, 2020
@dsharlet
Copy link
Owner Author

std::is_assignable is broken in a different way on a different C++ STL...

@dsharlet dsharlet changed the title shape allows construction from incompatible shapes shape allows construction from incompatible shapes (std::is_constructible and std::is_assignable are broken for std::tuple on various STLs) Jul 13, 2020
@dsharlet
Copy link
Owner Author

I think this is not actually technically broken on the various STLs I've tried, it just fails in a way that doesn't produce the right SFINAE behavior. It produces large ugly stacks of compiler errors from inside std::is_constructible, instead of producing a false value.

@jiawen
Copy link
Collaborator

jiawen commented Feb 25, 2023

This issue is kinda important. Is it still a problem with STLs in use in 2023? To retain backwards compatibility, do we want to consider:

  1. Implementing our own internal::is_constructible.
  2. Adding an #ifdef to use std::is_constructible for users whose toolchains are not broken.
  3. Reporting the bug and having it fixed upstream.

@dsharlet
Copy link
Owner Author

dsharlet commented Mar 9, 2023

I tried re-enabling the usage of this here: https://github.com/dsharlet/array/tree/is_constructible. It seems to work fine, but actually relying on it to catch failures produces garbagy results for me still. You can try uncommenting this test and seeing what happens: https://github.com/dsharlet/array/blob/master/test/errors.cpp#L57-L61

I've found another problem here: the errors.cpp test is currently not passing on gcc, but it "passes" because -ferror-limit=0 is an unrecognized command line option on gcc, so it doesn't compile anything and the grep statement doesn't have a problem with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants