This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: For some class F, I can declare a variable of type F::F, or F::F::F, etc.


We come across what seems to be a bug in gcc. If a class F has a public zero argument constructor, then we can declare a variable of type F::F, F::F::F, etc. For example, the following source file:
// foo.cpp
class F {};
F::F::F::F::F f;

See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11764


Still accepts-invalid with g++-4.3.2.

compiles with out errors in g++. The result is as if f is declared with
F f;
This is the case with the stock/latest GCC in Debian GNU/Linux x86_64 (v.4.1.2) and in Cygwin (v.3.4.4).
Is this the intended behavior?

No. :)


Fang

David Fang
Computer Systems Laboratory
Electrical & Computer Engineering
Cornell University
http://www.csl.cornell.edu/~fang/
	-- (2400 baud? Netscape 3.0?? lynx??? No problem!)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]