www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10528] New: Private constant (enum) properties not private

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10528

           Summary: Private constant (enum) properties not private
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: anoneuron gmail.com


--- Comment #0 from anoneuron gmail.com 2013-07-03 08:21:34 PDT ---
Manifest constants don't seem to honour the 'private' attribute when inside
aggregate type definitions. Here's an example:

/* --- module1.d --- */

private enum string ModuleData = "asdfgh";
struct Structure {
    static private enum string Data = "qwerty";
};

/* --- module2.d --- */

import module1;
import std.stdio;

void main() {
    writeln(ModuleData); // Error: mod1.ModuleData is private (correct)
    writeln(Structure.Data); // no error (incorrect)
};


I can't find any reason why this might be permitted, so it seems like a bug to
me.
Tested using DMD v2.063.2 on WinXP.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 03 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10528



--- Comment #1 from Adrien Pensart <crunchengine gmail.com> 2013-07-04 01:56:36
PDT ---
Created an attachment (id=1228)
Testcase for visibility attribute bug

A simpler testcase, visibility attribute is completely broken, it could cause
big troubles...

tested on 2.063 on Windows XP, could someone test on other platforms ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 04 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10528


Adrien Pensart <crunchengine gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crunchengine gmail.com
           Severity|normal                      |major


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 04 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10528


Henning Pohl <henning still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |henning still-hidden.de
           Severity|major                       |normal


--- Comment #2 from Henning Pohl <henning still-hidden.de> 2013-07-04 04:42:55
PDT ---
(In reply to comment #1)
 Created an attachment (id=1228) [details]
 Testcase for visibility attribute bug
 
 A simpler testcase, visibility attribute is completely broken, it could cause
 big troubles...
 
 tested on 2.063 on Windows XP, could someone test on other platforms ?
In D "private" and "protected" symbols are also accessible in the module they are declared in. So your test case should compile. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 04 2013