[Issue 3882] Unused result of pure functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 1 17:02:00 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=3882
--- Comment #21 from Per Nordlöw <per.nordlow at gmail.com> 2014-03-01 17:01:58 PST ---
(In reply to comment #20)
> (In reply to comment #19)
>
> > What does test.f!int.f mean?
> > ...
> > @safe pure nothrow T f(T)(T x)
> > {
> > return x*x;
> > }
> > void main(string args[])
> > {
> > int x = 3;
> > f(x);
> > }
>
> f here is not a function, it's a function template.
>
> This code:
>
> @safe pure nothrow T f(T)(T x) {
> return x*x;
> }
>
> Is the same as:
>
> template f(T) {
> @safe pure nothrow T f(T x) {
> return x*x;
> }
> }
>
> So when you call f inside the test module with an int you are actually calling
> test.f!int.f
>
> For a templated function the second f is redundant in the error message.
Ahh, get it.
I guess I still need to figure out how to print test.f instead right?
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list