[PING] Re: Add const char* constructors for exception classes in <stdexcept>

Jonathan Wakely jwakely@redhat.com
Wed Jan 29 15:21:00 GMT 2014


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.)




More information about the Gcc-patches mailing list