Bug 10564 – Errors on the Template page of the language specification

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-07T04:06:00Z
Last change time
2014-04-23T00:13:56Z
Keywords
pull
Assigned to
andrej.mitrovich
Creator
tommitissari

Comments

Comment #0 by tommitissari — 2013-07-07T04:06:57Z
These are found on the page: http://dlang.org/template.html 1) In the spec it says: Even if template arguments are implicitly converted to the same template parameter type, they still refer to different instances: struct TFoo(int x) { } static assert(is(TFoo!(3) == TFoo!(2 + 1))); // 3 and 2+1 are both 3 of type int static assert(!is(TFoo!(3) == TFoo!(3u))); // 3u and 3 are different types ...but at least according to DMD, TFoo!(3) and TFoo!(3u) refer to the same type. 2) In the spec it says: Template arguments not implicitly deduced can have default values: void Foo(T, U=T*)(T t) { U p; ... } int x; Foo(&x); // T is int, U is int* ...but the last line should be: Foo(x); // T is int, U is int*
Comment #1 by andrej.mitrovich — 2014-04-22T22:32:32Z
(In reply to Tommi from comment #0) > These are found on the page: > http://dlang.org/template.html > > 1) In the spec it says: > ...but at least according to DMD, TFoo!(3) and TFoo!(3u) refer to the same > type. Fixed a while ago. > 2) In the spec it says: > > ...but the last line should be: > Foo(x); // T is int, U is int* Thanks, will be fixed. https://github.com/D-Programming-Language/dlang.org/pull/554
Comment #2 by github-bugzilla — 2014-04-23T00:13:55Z
Commits pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/0e4e60436d430eef73a41e44f587312bbc7ab546 Fix Issue 10564 - Fix wrong call to template. https://github.com/D-Programming-Language/dlang.org/commit/8199fd5a3087e330521538190b279649d93dd587 Merge pull request #554 from AndrejMitrovic/Fix10564 [Trivial] Issue 10564 - Fix wrong call to template.