Skip to content

Commit df546b5

Browse files
committed
Make Initialization example runnable
1 parent 8140d7c commit df546b5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

spec/function.dd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3039,6 +3039,7 @@ $(H3 $(LNAME2 function-delegate-init, Initialization))
30393039
a static member function, or a static nested function.
30403040
)
30413041

3042+
$(SPEC_RUNNABLE_EXAMPLE_RUN
30423043
---
30433044
struct S
30443045
{
@@ -3052,20 +3053,21 @@ $(H3 $(LNAME2 function-delegate-init, Initialization))
30523053
int delegate() dg = &s.member; // Ok, s supplies context pointer
30533054
assert(dg() == 1);
30543055

3055-
dg = &S.sfunc; // error
3056-
dg = &S.member; // error
3056+
//dg = &S.sfunc; // error
3057+
//dg = &S.member; // error
30573058

30583059
int moon() { return 2; }
30593060
dg = &moon; // Ok
30603061
assert(dg() == 2);
30613062

30623063
static int mars() { return 3; }
3063-
dg = &mars; // error
3064+
//dg = &mars; // error
30643065

30653066
dg = () { return 4; }; // Ok
30663067
assert(dg() == 4);
30673068
}
30683069
---
3070+
)
30693071

30703072
$(NOTE Function pointers can be passed to functions taking a delegate argument by passing
30713073
them through the $(REF toDelegate, std,functional) template, which converts any callable

0 commit comments

Comments
 (0)