[Issue 9977] New: Function local templates should be allowed
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 22 01:35:50 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9977
Summary: Function local templates should be allowed
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-04-22 01:35:50 PDT ---
Currently DMD accepts declaring template aggregates and functions inside
functions.
void test1()
{
struct S1(T) { T value; }
auto func1(T)(T value) { return value; }
static assert(is(S1!int == struct));
assert(func1(10) == 10);
}
But raw template declaration is not allowed.
void test2()
{
template S2(T) { struct S2 { T value; } } // line 10
template func2(T) { auto func2(T value) { return value; } } // line 11
static assert(is(S2!int == struct));
assert(func2(10) == 10);
}
Output:
test.d(10): Error: template definitions aren't allowed inside functions
test.d(11): Error: template definitions aren't allowed inside functions
Today, I think this is not reasonable limitation.
--
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