digitalmars.D.bugs - [Issue 5295] New: Template basename recognized as valid type inside template - shouldn't be.
- d-bugmail puremagic.com (36/36) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5295
- d-bugmail puremagic.com (14/14) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5295
- d-bugmail puremagic.com (10/10) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5295
- d-bugmail puremagic.com (35/35) Dec 03 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5295
http://d.puremagic.com/issues/show_bug.cgi?id=5295
Summary: Template basename recognized as valid type inside
template - shouldn't be.
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: ah08010-d yahoo.com
PST ---
This code runs with dmd -run under 2.49. Note the array C[], which I don't
think is valid. (If this IS considered valid, can someone explain the semantics
to me?)
======
module scratch;
class C(T) {
C[] ary;
void foo() {
foreach( a; ary ) {
a.bar();
}
}
void bar() {
}
}
void main() {
auto c = new C!int;
c.foo();
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5295
Simen Kjaeraas <simen.kjaras gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras gmail.com
PST ---
This seems not to be mentioned on http://digitalmars.com/d/2.0/template.html,
but it is well-known and oft-used. The idea is that instead of having to type
Foo!(int, bar, 42, MeaningOfLiff) everytime you want typeof(this), you can just
use Foo. Foo!(int, bar, 42, MeaningOfLiff) still works, so nothing (as far as I
can see) is lost.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5295
Simen Kjaeraas <simen.kjaras gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |blood.of.life gmail.com
PST ---
*** Issue 5298 has been marked as a duplicate of this issue. ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5295
Steven Schveighoffer <schveiguy yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |schveiguy yahoo.com
Resolution| |INVALID
18:20:05 PST ---
It's not explicitly mentioned, but it is covered indirectly.
Note that:
class C(T) {
...
}
is equivalent to
template C(T)
{
class C
{
...
}
}
If you look at it this way, then it becomes:
template C(T)
{
class C
{
C[] ary;
...
}
}
when you look at the class definition, it makes sense that C inside the class
refers to the class itself. as it would outside the template.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 03 2010









d-bugmail puremagic.com 