Multiple attribute specifiers

Ary Manzana asterite at gmail.com
Wed Sep 6 08:13:50 PDT 2006


If I write this inside a module:

--------------------------------------
public private int x;
--------------------------------------

it compiles perfectly.

What is the protection level of x? public or private? Well, you can try 
compiling it and using it to find out, but I think the compiler should 
issue a warning or, much better, an error.

This confusion also appears if I write

--------------------------------------
public {

	private {

		int x;

	}

}
--------------------------------------

Again, the same question. Is x public or private?

I was going to post this to the digitalmars.D.bugs list, but I want some 
comments on this before proceeding.

I know no one would want to write such a thing, but on the compiler side 
(or other tools) it is crucial to know what should be the semantic 
(because currently it's legal).

Thanks,
Ary



More information about the Digitalmars-d-learn mailing list