[Issue 566] New: Adding non-static members and functions to classes doesn't error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 18 11:05:26 PST 2006
http://d.puremagic.com/issues/show_bug.cgi?id=566
Summary: Adding non-static members and functions to classes
doesn't error
Product: D
Version: 0.174
Platform: PC
URL: http://www.digitalmars.com/d/template.html
OS/Version: Windows
Status: NEW
Keywords: spec
Severity: normal
Priority: P4
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: deewiant at gmail.com
OtherBugsDependingO 511
nThis:
Under the "Limitations" section, the spec states "[t]emplates cannot be used to
add non-static members or functions to classes" and showcases the following
code:
class Foo
{
template TBar(T)
{
T xx; // Error
int func(T) { ... } // Error
static T yy; // Ok
static int func(T t, int y) { ... } // Ok
}
}
The lines marked with "// Error" don't fail to compile, they simply behave as
though they were declared static. The static attribute on yy and the second
func() is thus redundant.
Either the spec or DMD is wrong here.
--
More information about the Digitalmars-d-bugs
mailing list