On Monday, 22 August 2016 at 17:22:28 UTC, H. S. Teoh wrote:
I think it should be possible even with recursion, at least if there is a non-recursive branch in the function(s). Of course, it may not necessarily be *feasible* to implement the required analysis in the compiler. But maybe for the simplest cases, e.g.:

        auto func(...) {
                if (condition)
                        return finalResult;
                else
                        return func(...);
        }


T

I must be missing something here, but isn't it trivial to infer attributes for a recursive function? By definition you either have a call to the current function, which is idempotent in regards to attributes, or some non-recursive work that is done, in which case you follow the normal inference algorithm. I know this is exactly the basic case that you have shown, but even for more complex cases such as mutually-recursive functions I can't see this being unmanageable.

Reply via email to