-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Issue 11545 - Aggregate function literal member should not have access to enclosing scope #2824
Conversation
|
Does it still work with 'delegate' instead of 'function' ? |
|
Currently, declaring delegate in aggregate DeclDefs scope is not allowed ( |
|
I'm not sure if this will be fixed by this pull request in its current state, but it should also be noted that: |
| @@ -2833,6 +2833,12 @@ Expression *NewExp::interpret(InterState *istate, CtfeGoal goal) | |||
| VarDeclaration *v = s->isVarDeclaration(); | |||
| assert(v); | |||
| Expression *m; | |||
| if (v->inuse) | |||
| { | |||
| error("cannot construct class %s during field %s.%s initializer semantic", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this related to 11545?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is related to the improvement of test/fail_compilation/ice10259.d. Without this change, the added test case will cause ICE.
|
@Garciat Between class and struct, there's no difference to the issue. Your example will also be fixed by this. |
|
Thanks for fixing this! 👍 |
|
I noticed a problem with this pull (not a regression): This still fails to compile, with the cryptic message |
| @@ -720,6 +720,8 @@ class FuncLiteralDeclaration : public FuncDeclaration | |||
| Dsymbol *syntaxCopy(Dsymbol *); | |||
| bool isNested(); | |||
| bool isVirtual(); | |||
| bool addPreInvariant(); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an unrelated change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is necessary to skip invariant emission for the lambdas in aggregate member scope.
class C {
enum x = () { ... }; // This lambda should not have invariant
invariant {}
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, what confused me was the missing override, but we're in C++. Doh!
|
LGTM other than the introduction of |
…ccess to enclosing scope
|
Auto-merge toggled on |
Issue 11545 - Aggregate function literal member should not have access to enclosing scope
|
Thanks! |
|
Thanks everyone! This is a great improvement. DustMite master should now compile for everyone :) |
|
This PR introduced this bug: https://issues.dlang.org/show_bug.cgi?id=13424 |
https://d.puremagic.com/issues/show_bug.cgi?id=11545