[Issue 10533] New: Bad diagnostic when template has alias overloads
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 3 18:59:29 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10533
Summary: Bad diagnostic when template has alias overloads
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: diagnostic
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> 2013-07-03 18:59:28 PDT ---
-----
struct S1
{
T get(T)() if (is(T == float)) { }
}
struct S2
{
auto get(alias value)()
{
return S1.get!(typeof(value));
}
}
struct S3
{
auto get(alias value)()
{
return get!(typeof(value));
}
T get(T)() if (is(T == float))
{
return T.init;
}
}
void main()
{
// Error: template instance get!int does not match template declaration
get(T)() if (is(T == float))
S1.get!int;
// Error: template instance get!int does not match template declaration
get(T)() if (is(T == float))
S2.get!1;
// Error: cannot resolve type for this.get!int
S3.get!1;
}
-----
Observations:
S2.get calls into S1.get, and creates a nice error message. However in S3 the
get templates are overloaded against each other, and this causes the diagnostic
to become bad. S3.get should have the same diagnostic as S2.get.
--
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