www.digitalmars.com         C & C++   DMDScript  

c++.beta - default c'tor - syntax problem

reply Richard Grant <fractal clark.net> writes:
The example below compiles fine with "A a();" in main replaced with "A a;". 

AFAIK there should be no problem with either syntax..

struct A {
A() { }
void fn() { }
};

void main() {
A a();
a.fn();
// Error: not a struct or union type
// Warning 6: value of expression is not used
}

Low priority.

Richard
Feb 09 2003
parent reply Christof Meerwald <cmeerw web.de> writes:
On Sun, 9 Feb 2003 16:13:39 +0000 (UTC), Richard Grant wrote:
 void main() {
 A a();
This declares "a" as a function returning A.
 a.fn();
 // Error: not a struct or union type
 // Warning 6: value of expression is not used
 }
AFAIK, DMC's behaviour is correct. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Feb 09 2003
parent Richard Grant <fractal clark.net> writes:
In article <b260id$2c3g$1 digitaldaemon.com>, Christof Meerwald says...
On Sun, 9 Feb 2003 16:13:39 +0000 (UTC), Richard Grant wrote:
 void main() {
 A a();
This declares "a" as a function returning A.
 a.fn();
 // Error: not a struct or union type
 // Warning 6: value of expression is not used
 }
AFAIK, DMC's behaviour is correct.
And you are correct.. Thanks, Richard
Feb 09 2003