Skip to content

Commit 4a4f7f3

Browse files
pbackusGeod24
authored andcommitted
spec/template.dd: correct misleading IFTI example
Contrary to what was previously stated in the text, the example did not fail because the template parameter T was specialized. Instead, it failed because the T used in the template parameter list referred to a different type than the T used in the function parameter list, and the former could not be deduced from the latter. To make the example clearer, the second T has been changed to U, and the text has been updated accordingly.
1 parent 1cea9a5 commit 4a4f7f3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spec/template.dd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,14 +1209,14 @@ $(H3 $(LNAME2 ifti, Implicit Function Template Instantiation (IFTI)))
12091209
$(H4 $(LNAME2 ifti-restrictions, Restrictions))
12101210

12111211
$(P Function template type parameters that are to be implicitly
1212-
deduced may not have specializations:)
1212+
deduced must appear in the type of at least one function parameter:)
12131213

12141214
------
1215-
void $(CODE_HIGHLIGHT foo)(T : T*)(T t) { ... }
1215+
void foo(T : U*, U)(U t) { ... }
12161216

1217-
int x,y;
1218-
foo!(int*)(x); // ok, T is not deduced from function argument
1219-
foo(&y); // error, T has specialization
1217+
int x;
1218+
foo!(int*)(x); // ok, U is deduced and T is specified explicitly
1219+
foo(x); // error, only U can be deduced, not T
12201220
------
12211221

12221222
$(P When the template parameters must be deduced, the

0 commit comments

Comments
 (0)