Kenji Hara <> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--- Comment #6 from Kenji Hara <> 2011-11-23 16:27:10 PST ---
(In reply to comment #4)
> I believe this is not a bug. The type of a template is based on what its
> argument types are, not its parameter types. Hence,
>   foo!3
> is always a different type from:
>   foo!3u
> even if foo is defined to take an int parameter.

The issue is that the foo template with signed integer makes incorrect
instantiation internally.

There are two solutions:
1. Makes that instantiation invalid.
2. Promote signed integer template value parameter into unsigned.

My patch implements #2, and I believe that is correct.
Because non-suffix integer literal can implicitly convertible to unsigned.

And, my patch doesn't break existing code around template overloading.
Following code still valid.

template Foo(int n){ enum Foo = 1; }
template Foo(uint n){ enum Foo = 2; }
static assert(Foo!10 == 1);
static assert(Foo!10u == 2);

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to