std::is_copy_constructible::value is always true for variant<Ts...>
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reviewing the variant implementation's special member constructors and the linked Stack Overflow solution; the issue names no source file or test. Determine whether copy and move type traits correctly reflect non-copyable alternatives without unwanted side effects, then verify the resulting behavior with focused coverage.
Written by the indexing model from the issue text.
Description
The copy constructor only actually compiles when all member types are copyable, as it should. However, when checking whether the variant type is copy-constructible via SFINAE, e.g. with std::is_copy_constructible, you will always get true, because the copy constructor always exists, whether or not it is valid. The same applies to move constructors, and copy / move assignment operators.
I first thought I could fix this with a simple enable_if on each of the methods, but as it turns out I can't because if you make templates out of any of these special methods, they are not those special methods anymore. I did find a solution on StackOverflow, though I'm not entirely certain if it might introduce unwanted side effects. Could you have a look? In case it seems unproblematic to you, I would be happy to try implementing it here.
- Dominant language
- C++
- Stars
- 385
- Forks
- 96
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/variant
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Possible data corruption when assigning variant to itselfMay be free again @artemp claimed this 3188 days ago, and no pull request is open. Open
Similar issues
-
agent:WSL bug linux LOW ui
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Copter: PosHold brake-entry threshold became 16 deg instead of 0.16 deg after the radians conversionOpen
Difficulty 1/5 Under an hour Newbie friendliness 78/100
ArduPilot/ardupilot#34617 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Self-hosted runner Dockerfile pins actions/runner 2.327.1, below GitHub's new minimum (2.329.0)Openauto-triaged bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microsoft/microsoft-ui-xaml#12158 ·
Maintainers usually reply within 1 day
-
Hexfloat ('a'/'A') zero padding is placed before the sign and "0x" prefixPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 4 days