[Bug libstdc++/89477] Incorrect CTAD deduction guides for set and multiset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89477 --- Comment #6 from François Dumont --- Author: fdumont Date: Fri Mar 8 05:53:09 2019 New Revision: 269479 URL: https://gcc.gnu.org/viewcvs?rev=269479&root=gcc&view=rev Log: 2019-03-08 François Dumont PR libstdc++/89477 * include/debug/map.h (map): Use _RequireNotAllocator to constrain parameters in deduction guides. * include/debug/multimap.h (multimap): Likewise. * include/debug/set.h (multimap): Likewise. * include/debug/multiset.h (multimap): Likewise. * include/debug/unordered_map (unordered_map): Likewise. (unordered_multimap): Likewise. * include/debug/unordered_set (unordered_set): Likewise. (unordered_multiset): Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/debug/map.h trunk/libstdc++-v3/include/debug/multimap.h trunk/libstdc++-v3/include/debug/multiset.h trunk/libstdc++-v3/include/debug/set.h trunk/libstdc++-v3/include/debug/unordered_map trunk/libstdc++-v3/include/debug/unordered_set
[Bug libstdc++/89477] Incorrect CTAD deduction guides for set and multiset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89477 Mike Spertus changed: What|Removed |Added CC||mike at spertus dot com --- Comment #5 from Mike Spertus --- Since this deduction comes from the standard’s set(set, Allocator) constructor, I would say that in this case the gnu behavior is conforming and the MSVC behavior is not (not implying anything here about what the standard should say, just what it does...).
[Bug libstdc++/89477] Incorrect CTAD deduction guides for set and multiset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89477 --- Comment #4 from Arthur O'Dwyer --- libstdc++ passes all my test cases now except this one: ``` // https://godbolt.org/z/kvh9Ih #include std::set s; std::set t(s, std::allocator()); ``` The issue is that we humans can logically deduce t's Allocator parameter as "the same as s's Allocator parameter", but due to an implementation detail, the compiler is also trying to deduce t's Allocator parameter as std::allocator, and so it deduces conflicting types and fails deduction. This test case could be made to work if you changed https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_set.h#L124 from typedef _Alloc allocator_type; to typedef typename __identity<_Alloc>::type allocator_type; or whatever libstdc++'s equivalent of __identity is. MSVC's `set` already effectively does this, by inheriting its `allocator_type` typedef from a base class. I don't know whether the paper standard has a definite interpretation one way or the other; it might be open to interpretation, or it might even say that MSVC is wrong in this case. (Logically, I think MSVC *should* be right.) Perhaps a new bugzilla issue should be opened for this one.
[Bug libstdc++/89477] Incorrect CTAD deduction guides for set and multiset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89477 Jonathan Wakely changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|--- |9.0 --- Comment #3 from Jonathan Wakely --- Fixed for all associative and unordered containers.
[Bug libstdc++/89477] Incorrect CTAD deduction guides for set and multiset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89477 --- Comment #2 from Jonathan Wakely --- Author: redi Date: Tue Feb 26 23:12:44 2019 New Revision: 269234 URL: https://gcc.gnu.org/viewcvs?rev=269234&root=gcc&view=rev Log: PR libstdc++/89477 constrain deduction guides for maps and sets The Compare, Hash, and Pred template parameters should be constrained in the C++17 deduction guides for associative and unordered containers. The deduction guides for stack, queue and priority_queue are already constrained, but this patch makes them use the _RequireNotAllocator helper instead of reproducing the logic each time. PR libstdc++/89477 * include/bits/alloc_traits.h (_RequireNotAllocator): New helper for container deduction guides. * include/bits/hashtable.h (_RequireNotAllocatorOrIntegral): Likewise. * include/bits/stl_map.h (map): Use _RequireNotAllocator to constrain parameters in deduction guides. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_queue.h (queue, priority_queue): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_stack.h (stack): Likewise. * include/bits/unordered_map.h (unordered_map, unordered_multimap): use _RequireNotAllocator and _RequireNotAllocatorOrIntegral to constrain parameters in deduction guides. * include/bits/unordered_set.h (unordered_set, unordered_multiset): Likewise. * testsuite/23_containers/map/cons/deduction.cc: Test additional deduction cases. * testsuite/23_containers/multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/set/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/alloc_traits.h trunk/libstdc++-v3/include/bits/hashtable.h trunk/libstdc++-v3/include/bits/stl_map.h trunk/libstdc++-v3/include/bits/stl_multimap.h trunk/libstdc++-v3/include/bits/stl_multiset.h trunk/libstdc++-v3/include/bits/stl_queue.h trunk/libstdc++-v3/include/bits/stl_set.h trunk/libstdc++-v3/include/bits/stl_stack.h trunk/libstdc++-v3/include/bits/unordered_map.h trunk/libstdc++-v3/include/bits/unordered_set.h trunk/libstdc++-v3/testsuite/23_containers/map/cons/deduction.cc trunk/libstdc++-v3/testsuite/23_containers/multiset/cons/deduction.cc trunk/libstdc++-v3/testsuite/23_containers/set/cons/deduction.cc trunk/libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc trunk/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc trunk/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc trunk/libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc
[Bug libstdc++/89477] Incorrect CTAD deduction guides for set and multiset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89477 --- Comment #1 from Arthur O'Dwyer --- Similar cases for `unordered_{multi,}set` as well. // https://godbolt.org/z/onYid6 #include int main() { const int arr[] = { 1, 2, 3 }; std::unordered_set s(arr, arr+3, 42, std::hash(), std::allocator()); std::unordered_set t({ 1, 2, 3 }, 42, std::allocator()); }
[Bug libstdc++/89477] Incorrect CTAD deduction guides for set and multiset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89477 Jonathan Wakely changed: What|Removed |Added Keywords||rejects-valid Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2019-02-23 Version|unknown |9.0 Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Ever confirmed|0 |1