Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions function.dd
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,21 @@ void bar()
test();
int i = fp(); // i is set to 10
}
------

$(P $(B Note:) Two functions with identical bodies, or two functions
that compile to identical assembly code, are not guaranteed to have
distinct function pointer values. The compiler is free to merge
functions bodies into one if they compile to identical code.)

------
int abc(int x) { return x + 1; }
int def(int y) { return y + 1; }

int function() fp1 = &abc;
int function() fp2 = &def;
// Do not rely on fp1 and fp2 being different values; the compiler may merge
// them.
------

$(P A delegate can be set to a non-static nested function:)
Expand Down