File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -3039,6 +3039,7 @@ $(H3 $(LNAME2 function-delegate-init, Initialization))
3039
3039
a static member function, or a static nested function.
3040
3040
)
3041
3041
3042
+ $(SPEC_RUNNABLE_EXAMPLE_RUN
3042
3043
---
3043
3044
struct S
3044
3045
{
@@ -3052,20 +3053,21 @@ $(H3 $(LNAME2 function-delegate-init, Initialization))
3052
3053
int delegate() dg = &s.member; // Ok, s supplies context pointer
3053
3054
assert(dg() == 1);
3054
3055
3055
- dg = &S.sfunc; // error
3056
- dg = &S.member; // error
3056
+ // dg = &S.sfunc; // error
3057
+ // dg = &S.member; // error
3057
3058
3058
3059
int moon() { return 2; }
3059
3060
dg = &moon; // Ok
3060
3061
assert(dg() == 2);
3061
3062
3062
3063
static int mars() { return 3; }
3063
- dg = &mars; // error
3064
+ // dg = &mars; // error
3064
3065
3065
3066
dg = () { return 4; }; // Ok
3066
3067
assert(dg() == 4);
3067
3068
}
3068
3069
---
3070
+ )
3069
3071
3070
3072
$(NOTE Function pointers can be passed to functions taking a delegate argument by passing
3071
3073
them through the $(REF toDelegate, std,functional) template, which converts any callable
You can’t perform that action at this time.
0 commit comments