[Issue 5184] New: throw ClassName.templatedStaticMethod(...) cannot be parsed
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 7 01:19:54 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5184
Summary: throw ClassName.templatedStaticMethod(...) cannot be
parsed
Product: D
Version: D1 & D2
Platform: All
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: kiki at kmonos.net
--- Comment #0 from Kazuhiro Inaba <kiki at kmonos.net> 2010-11-07 01:18:51 PST ---
The following code doesn't compile (in dmd 2.050 and 1.065), but I think it
should.
class Factory
{
static Exception create(T)(T x)
{
return new Exception("whatever");
}
}
void main()
{
throw Factory.create(123);
}
Error message is the following:
> test.d(11): Error: type Factory is not an expression
Either one of the changes dissolves the compilation failure:
- Changing the method declaration into a non-template
create(int x)
- Decomposing the throw statement as
auto e = Factory.create(123); throw e;
The combination of throw+static+template seems causing a trouble.
--
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