Work around http://gcc.gnu.org/PR52796 in gcc-4.6 by adding an
overload of each function that passes a parameter pack directly as the
only arguments of an object's constructor, which explicitly takes no
arguments in place of the pack.
Tested with check-c++ and by trying to provoke the bug in valgrind for
each changed location. Some of the insert_aux locations appear
inaccessible because of missing emplace() functions.
I plan to only apply this to the google/gcc-4_6 branch, since gcc-4.7
already makes these cases work properly.
2012-03-30 Jeffrey Yasskin jyass...@google.com
* libstdc++-v3/include/ext/pool_allocator.h: Add 1-argument construct()
method.
* libstdc++-v3/include/ext/bitmap_allocator.h: Likewise.
* libstdc++-v3/include/ext/new_allocator.h: Likewise.
* libstdc++-v3/include/ext/malloc_allocator.h: Likewise.
* libstdc++-v3/include/ext/array_allocator.h: Likewise.
* libstdc++-v3/include/ext/mt_allocator.h: Likewise.
* libstdc++-v3/include/ext/extptr_allocator.h: Likewise.
* libstdc++-v3/include/bits/stl_construct.h:Add 1-argument _Construct
function.
* libstdc++-v3/include/bits/stl_list.h: Add default _List_node
constructor.
* libstdc++-v3/include/bits/hashtable_policy.h: Add default _Hash_node
constructor.
* libstdc++-v3/include/bits/forward_list.h:Add default _Fwd_list_node
constructor.
* libstdc++-v3/include/bits/stl_tree.h:Add default _Rb_tree_node
constructor.
*
libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc:
Update line numbers.
*
libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc:
Likewise.
*
libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc:
Likewise.
*
libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc:
Likewise.
*
libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Likewise.
*
libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
*
libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
Likewise.
*
libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
Likewise.
Index: libstdc++-v3/include/ext/pool_allocator.h
===
--- libstdc++-v3/include/ext/pool_allocator.h (revision 186024)
+++ libstdc++-v3/include/ext/pool_allocator.h (working copy)
@@ -165,6 +165,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ ::new((void *)__p) _Tp(__val); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Work around PR52796 by avoiding 0-length parameter packs
+ // passed to constructors.
+ void
+ construct(pointer __p)
+ { ::new((void *)__p) _Tp(); }
+
templatetypename... _Args
void
construct(pointer __p, _Args... __args)
Index: libstdc++-v3/include/ext/bitmap_allocator.h
===
--- libstdc++-v3/include/ext/bitmap_allocator.h (revision 186024)
+++ libstdc++-v3/include/ext/bitmap_allocator.h (working copy)
@@ -1058,6 +1058,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ ::new((void *)__p) value_type(__data); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Work around PR52796 by avoiding 0-length parameter packs
+ // passed to constructors.
+ void
+ construct(pointer __p)
+ { ::new((void *)__p) _Tp(); }
+
templatetypename... _Args
void
construct(pointer __p, _Args... __args)
@@ -1109,4 +1115,3 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace __gnu_cxx
#endif
-
Index: libstdc++-v3/include/ext/new_allocator.h
===
--- libstdc++-v3/include/ext/new_allocator.h(revision 186024)
+++ libstdc++-v3/include/ext/new_allocator.h(working copy)
@@ -115,6 +115,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ ::new((void *)__p) _Tp(__val); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Work around PR52796 by avoiding 0-length parameter packs
+ // passed to constructors.
+ void
+ construct(pointer __p)
+ { ::new((void *)__p) _Tp(); }
+
templatetypename... _Args
void
construct(pointer __p, _Args... __args)
Index: libstdc++-v3/include/ext/malloc_allocator.h
===
--- libstdc++-v3/include/ext/malloc_allocator.h (revision 186024)
+++ libstdc++-v3/include/ext/malloc_allocator.h (working copy)
@@ -111,6 +111,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ ::new((void *)__p) value_type(__val); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Work around PR52796 by avoiding 0-length parameter packs
+ // passed to constructors.
+ void
+ construct(pointer __p)
+ { ::new((void *)__p)