Skip to content

Commit 557f7f8

Browse files
committed
spec update following dlang/dmd#7831
1 parent 38e7335 commit 557f7f8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spec/template.dd

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,23 @@ $(H2 $(LNAME2 function-templates, Function Templates))
10821082
}
10831083
---
10841084

1085+
$(P Variadic Function Templates can have parameters with default values.
1086+
These parameters are always set to their default value in case of IFTI.
1087+
)
1088+
1089+
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
1090+
---
1091+
size_t fun(T...)(T t, string file = __FILE__)
1092+
{
1093+
import std.stdio;
1094+
writeln(file, " ", t);
1095+
return T.length;
1096+
}
1097+
assert(fun(1, "foo") == 2); // uses IFTI
1098+
assert(fun!int(1, "foo") == 1); // no IFTI
1099+
---
1100+
)
1101+
10851102
$(H2 $(LNAME2 variable-template, Variable Templates))
10861103

10871104
$(P Same as aggregates and functions, variable declarations with

0 commit comments

Comments
 (0)