https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89299
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- For now I suggest this patch for the docs: --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -6815,6 +6815,11 @@ does not allow the exception to be caught, only to perform an action. It is undefined what happens if @var{cleanup_function} does not return normally. +In C++ the @var{cleanup_function} must be a normal function. +Other types of callable such as a function templates, +lambda expressions or function objects with @code{operator()} +are not supported. + @item common @itemx nocommon @cindex @code{common} variable attribute