classes inside functions?!
Hasan Aljudy
hasan.aljudy at gmail.com
Sun Apr 30 00:57:30 PDT 2006
I don't know if this is a bug or what, but for some reason, dmd allows
you to define classes/structs/unions/enums as statements inside function
bodies.
Oddly enough, you cannot define a template in the same way
I didn't find in the docs any mention of whether aggregates are allowed
inside function bodies or not.
Walter, is this the correct behaviour?
The following compiles ok
##
void main()
{
enum X
{
A,
B,
}
struct Y
{
int x;
int y;
char a;
}
class R
{
Y g;
X d;
}
}
##/
but the following doesn't work
##
void main()
{
class R
{
Y g;
X d;
}
template kill(X)
{
void kill()
{
}
}
}
##/
gives the following error messeges:
# found 'template' instead of statement
More information about the Digitalmars-d
mailing list