LWG 3076 basic_string CTAD ambiguity
commit95ca8acac4f60ebeeb755d57928c245107ead9d1
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Jun 2018 23:47:33 +0000 (15 23:47 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Jun 2018 23:47:33 +0000 (15 23:47 +0000)
tree3832e99a38a93f602448cf201bcc0f32394479ca
parent0245ae7169594da92f3e07997f6a6ccdadd6847e
LWG 3076 basic_string CTAD ambiguity

When deduction guides are supported by the compiler (i.e. for C++17 and
later) replace two basic_string constructors by constrained function
templates as required by LWG 3075. In order to ensure that the pre-C++17
non-template constructors are still exported from the shared library
define a macro in src/c++11/string-inst.cc to force the non-template
declarations (this isn't strictly needed yet, because the string
instantiations are compiled with -std=gnu++11, but that is likely to
change).

LWG 3076 basic_string CTAD ambiguity
* doc/xml/manual/intro.xml: Document LWG 3076 change.
* include/bits/basic_string.h
[__cpp_deduction_guides && !_GLIBCXX_DEFINING_STRING_INSTANTIATIONS]
(basic_string(const _CharT*, const _Alloc&)): Turn into a function
template constrained by _RequireAllocator.
(basic_string(size_type, _CharT, const _Alloc&)): Likewise.
* src/c++11/string-inst.cc (_GLIBCXX_DEFINING_STRING_INSTANTIATIONS):
Define.
* testsuite/21_strings/basic_string/cons/char/deduction.cc: Test
deduction
* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261670 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/doc/xml/manual/intro.xml
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/src/c++11/string-inst.cc
libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc
libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc