This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING] Re: Add const char* constructors for exception classes in <stdexcept>
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Oleg Endo <oleg dot endo at t-online dot de>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 29 Jan 2014 15:21:36 +0000
- Subject: Re: [PING] Re: Add const char* constructors for exception classes in <stdexcept>
- Authentication-results: sourceware.org; auth=none
- References: <1387411826 dot 2455 dot 325 dot camel at yam-132-YW-E178-FTW> <CAH6eHdTK93RwatvT+m_1TLv7Ni=yQ=wDi6v7Hq=jT=O=ZSffzw at mail dot gmail dot com> <1387466908 dot 2455 dot 355 dot camel at yam-132-YW-E178-FTW> <1390745736 dot 22215 dot 207 dot camel at yam-132-YW-E178-FTW>
On 26/01/14 15:15 +0100, Oleg Endo wrote:
Files in libstdc++-v3/src/c++98/ seem to be never compiled with C++11.
Thus I can think of two options:
1) Add const char* ctors for C++98 and C++11.
2) Add #ifdef'ed declarations to libstdc++-v3/include/std/stdexcept and
add a new file libstdc++-v3/src/c++11/stdexcept.cc with the
implementations.
3) Move stdexcept.cc from src/c++98 to src/c++11
4) Define the functions inline using forwarding constructors, which
means we don't need new exports.
The attached patch does 1).
I don't think we want the constructors in C++03 mode though, it could
break some valid programs e.g. a custom string type with implicit
conversion to const char* and std::string can be passed to an exception
constructor in C++03, but adding the overloads would make it
ambiguous.
I think I prefer option 4, it avoids adding new exports during Stage 3
(although the patch was initially posted during Stage 1, it is now
quite late to add new exports, which is not your fault but still a
concern.)