4107 – Duplicate documentation for member function templates

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4107 - Duplicate documentation for member function templates
Summary: Duplicate documentation for member function templates
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: ddoc, patch
Depends on:
Blocks:
Reported: 2010年04月21日 02:27 UTC by Lars T. Kyllingstad
Modified: 2014年02月15日 02:43 UTC (History)
2 users (show)

See Also:


Attachments
DDoc output (670 bytes, text/html)
2010年04月21日 02:27 UTC, Lars T. Kyllingstad
Details
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Lars T. Kyllingstad 2010年04月21日 02:27:12 UTC
Created attachment 611 [details] 
DDoc output
When a templated class/struct contains a member function template, the
documentation for the latter is printed twice in the resulting HTML file; once
for the template and once for the function.
 /// struct doc
 struct Bug4107(T)
 {
 /// templated function doc
 void foo(U)(U u) { }
 }
I've attached the HTML file generated by DDoc.
Comment 1 kennytm 2011年06月04日 11:45:40 UTC
The bug is that, DMD only recognizes the "a template declares exactly one member, and that member is a function with the same name as the template" (is there are short-form for that?) during semantic(), but the template isn't instantiated, so its members won't be semantic()-ed. Therefore, does not know that 'foo' is a "magic one-member template", and emits the ddoc comment as if it's a regular template.
A related bug is when there are nested templated aggregates, the inner levels won't be shown in DDoc.
----------------------------------
/// alpha
struct Bug4107b(T) {
 /// beta
 public struct B(U) {
 /// gamma
 public struct C(V) {
 /// delta
 public struct D(W) {
 }
 }
 }
}
----------------------------------
Comment 2 kennytm 2011年06月04日 12:54:48 UTC
DMD pull request #84.
https://github.com/D-Programming-Language/dmd/pull/84 


AltStyle によって変換されたページ (->オリジナル) /