-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Labels
status: gnarlyThis issue is likely to require very significant work to resolveThis issue is likely to require very significant work to resolvetype: bugThe Standard does not describe the language as intended or implementedThe Standard does not describe the language as intended or implemented
Description
This is a companion issue to #169
12.7.5 (member access) suggests that evaluating a member access expression performs a nullity check.
12.18.2 (simple assignment) states for an assignment x = y:
- If x is classified as a variable:
- x is evaluated to produce the variable.
- y is evaluated and, if required, converted to the type of x through an implicit conversion (§12.2).
That all sounds fine, but my understanding of reality is that the nullity check is only performed after y is evaluated. Sample code to show that...
public class Q {
public int x;
public static void Main() {
Q q = null;
q.x = SideEffect();
}
public static int SideEffect()
{
System.Console.WriteLine("SideEffect");
return 2;
}
}Assigning to Mads initially as he has been assigned #169
Metadata
Metadata
Assignees
Labels
status: gnarlyThis issue is likely to require very significant work to resolveThis issue is likely to require very significant work to resolvetype: bugThe Standard does not describe the language as intended or implementedThe Standard does not describe the language as intended or implemented