https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78710

            Bug ID: 78710
           Summary: suggest better exception text for stoi, stol, ...
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nico at josuttis dot de
  Target Milestone: ---

stoi("hello") currently throws an exception where what() only outputs "stoi"
(nothing else).

The reason is (if I analyzed it correctly):
- stoi etc. pass their name (just "stoi") to __stoa as __name
- __stoa calls:
    std::__throw_invalid_argument(__name);
- which usually seems to call _GLIBCXX_THROW_OR_ABORT

Some component (either __stoa() or __throw_invalid_argument())
should extend the message at least a bit.
E.g. __stoa() might call
       std::__throw_invalid_argument("invalid argument for " + __name)
(using a valid syntax of course).

Reply via email to