Skip to content

Commit

Permalink
fix Issue 3467 - Non-int integral template parameters not correctly p…
Browse files Browse the repository at this point in the history
…ropagated
  • Loading branch information
9rnsr committed Mar 1, 2014
1 parent 09a49af commit 2a56f5c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions template.dd
Expand Up @@ -130,8 +130,7 @@ $(GNAME TemplateSingleArgument):
)

$(P Multiple instantiations of a $(I TemplateDeclaration) with the same
$(I TemplateArgumentList), before implicit conversions,
all will refer to the same instantiation.
$(I TemplateArgumentList) all will refer to the same instantiation.
For example:

------
Expand All @@ -149,12 +148,17 @@ $(GNAME TemplateSingleArgument):
)

$(P Even if template arguments are implicitly converted to the same
template parameter type, they still refer to different instances:
template parameter type, they still refer to same instance:

-----
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

// 3 and 2+1 are both 3 of type int
static assert(is(TFoo!(3) == TFoo!(2 + 1)));

// 3u is implicitly converted to 3 to match int parameter,
// and refers exactly same instance with TFoo!(3).
static assert(is(TFoo!(3) == TFoo!(3u)));
-----
)

Expand Down

0 comments on commit 2a56f5c

Please sign in to comment.