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

--- Comment #28 from Hana Dusíková <hanicka at hanicka dot net> ---
(In reply to Jakub Jelinek from comment #27)
> (In reply to Hana Dusíková from comment #26)
> > (In reply to Jakub Jelinek from comment #25)
> > > In the end this is done only for classes derived from std::exception, to
> > > match e.g. the verbose terminate handler at runtime.
> > 
> > I wonder why?
> 
> Jason Merrill asked for that during patch review:
> https://gcc.gnu.org/pipermail/gcc-patches/2025-July/688997.html
> "This will work for any class type with a what() method, which is 
> different from vterminate.cc that only calls what() for a type derived 
> from std::exception.  I think it makes sense to be consistent with that; 
> a what() from an unrelated class might mean something different."

Okay, what I tried (and failed to my limited knowledge of doing it lowlevel
without AST present) is to allow any `constexpr const` overload of `what`
without arguments which returns pointer to any char type or anything which has
`.size()` and `.data()` returning pointer to any char type. Because then I can
do the formatting only when `what()` is evaluated. But this interpretation of
wording is also correct.

Reply via email to