This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/69300, ICE with self-referential noexcept


On Wed, 28 Jun 2017, Jason Merrill wrote:

In the testcase we SEGV due to infinite recursion because the
noexcept-specifier of f depends on itself.  Fixed by keeping track of
which functions we're currently trying to instantiate noexcept for.

Hello,

in the testcase, it makes sense that this is an error. In some other cases, say for instance

int fact(int n) noexcept(auto) { return (n>1)?n*f(n-1):1; }

(yes, I know we still do not have noexcept(auto))
it would make sense to pretend that the recursive call does not throw for the purpose of determining that fact is indeed noexcept. Then we get into solving the same thing as IPA already does... And the standard does not require implementations to be clever there. Still, it could have been nice :-/

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]