New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-626] No diagnostic for unconditional recursion #43243
Comments
cc @DougGregor |
This is recursing infinitely, so it crashes when it runs out of stack space, just like func f() { f() }
f() |
Ah, so this is fully correct type-checking-wise, but it would be nice™ to warn on unconditional recursion, like Clang does. |
I think maybe the warning should be different depending on the case.
|
That's not necessarily true; you could pass different arguments to it. |
@belkadan In that case it would be a convenience initializer, I mean a normal non-convenience initializer. |
Oh, good point. Designated initializers can't delegate. Okay, I'll un-dup your original bug. |
No, wait, a struct initializer doesn't have to be marked |
In that case, the compiler should throw an error for non-convenience class initializers. It may be a small thing, be it makes the language safer. I had a property that I initialized in a class before init() (e.g. var property = Foo()). I spent 2 days debugging this in my code and tracking it down, since it would crash before arriving at init() it was hard to track. It may be a simple mistake, but in large codebases can lead to hard to track bugs. |
It already does that:
|
Resolved by the merge of #11869. |
Environment
Swift version 3.0-dev (LLVM f95d47afa7, Clang f66c5bb67b, Swift b745691)
Target: x86_64-unknown-linux-gnu
on Ubuntu 15.10
Additional Detail from JIRA
md5: 3d750f414400561a5ad5d932a92d4914
is duplicated by:
relates to:
Issue Description:
The following code compiles without errors but executing the created binary results in a Segfault:
The text was updated successfully, but these errors were encountered: