[Issue 4675] Eponymous Template should hide internal names

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 20 17:26:28 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4675


Torarin <torarin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |torarin at gmail.com


--- Comment #1 from Torarin <torarin at gmail.com> 2010-08-20 17:26:26 PDT ---
I ran into trouble with this example as well, but this time because what should
work, doesn't:

import std.stdio;

template isNumeric(T)
{
  enum bool test1 = is(T : long);
  enum bool test2 = is(T : real);
  enum bool isNumeric = test1 || test2;
}

void main()
{
  bool a = isNumeric!int;
}


Fails with:
test.d(12): Error: expression isNumeric!(int) is void and has no value.

I was surprised to find that the language reference actually contradicts TDPL
here:

"Implicit Template Properties
If a template has exactly one member in it, and the name of that member is the
same as the template name, that member is assumed to be referred to in a
template instantiation."


(In reply to comment #0)
>
> According to TDPL, calling isNumeric!(T) is rewritten by the compiler to
> isNumeric!(T).isNumeric, therefore hiding access to any other names.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list