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, Jun 28, 2017 at 5:11 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> 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.
>
> 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.

True; the recursive call can't make the function more throwy.

Jason


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