www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2775] New: "private" ignored for templates

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

           Summary: "private" ignored for templates
           Product: D
           Version: 1.041
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: cbkbbejeap mailinator.com


The following compiles successfully, but should result in some sort of "private
template not accessible" or "no such template in current scope" error:

// main.d
import imported;
void main()
{
        char[] str = foo!();
}

// imported.d
private template foo()
{
        const char[] foo = "foo";
}


-- 
Mar 31 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2775


jakobovrum gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakobovrum gmail.com


--- Comment #1 from jakobovrum gmail.com 2010-01-09 20:34:03 PST ---
(In reply to comment #0)
 The following compiles successfully, but should result in some sort of "private
 template not accessible" or "no such template in current scope" error:
 
 // main.d
 import imported;
 void main()
 {
     char[] str = foo!();
 }
 
 // imported.d
 private template foo()
 {
     const char[] foo = "foo";
 }

It happens for templated functions in DMD 2.039, as well. /* test.d */ module test; import std.stdio; class Class { private void foo(T...)(T args) { writeln("Hello, world!"); } } /* main.d */ module main; import test; int main() { scope a = new Class; a.foo(); return 0; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2010