[Issue 4675] New: Eponymous Template should hide internal names
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 18 13:19:20 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4675
Summary: Eponymous Template should hide internal names
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-08-18 13:19:16 PDT ---
Code:
import std.stdio;
void main()
{
}
template isNumeric(T)
{
enum bool test1 = is(T : long); // should be hidden
enum bool test2 = is(T : real); // should be hidden
enum bool isNumeric = test1 || test2;
}
unittest
{
static assert(isNumeric!(int).test1); // should be an error
writeln(isNumeric!(int).test1); // should be an error, but writes
true
writeln(isNumeric!(int).test2); // should be an error, but writes
true
}
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