[Issue 10411] New: Private aliases introduce conflicts and cause bad diagnostics
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 18 20:07:09 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10411
Summary: Private aliases introduce conflicts and cause bad
diagnostics
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-06-18 20:07:08 PDT ---
-----
module foo;
private
{
import std.stdio;
alias println = writeln;
}
-----
-----
module bar;
void println(string file = __FILE__, size_t line = __LINE__, Args...)(Args
args)
{
}
-----
-----
module main;
import foo;
import bar;
void main()
{
println("");
}
-----
$ C:\dev\code\d_code\conflict>dmd main.d
> DMD v2.064 DEBUG
> main.d(8): Error: bar.println!("main.d", 8u, string).println at bar.d(3)
> conflicts with std.stdio.writeln!(string).writeln at C:\dmd-git\dmd2\windows
> \bin\..\..\src\phobos\std\stdio.d(1728)
Note how a *private* alias in 'foo' ends up causing a conflict in the importing
module, and also note the horrible diagnostic: it doesn't tell us which module
caused the conflict ('foo' is not mentioned anywhere).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list