[Issue 1775] New: Code that compiles but shouldn't
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 9 03:59:43 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1775
Summary: Code that compiles but shouldn't
Product: D
Version: 1.015
Platform: PC
OS/Version: Linux
Status: NEW
Severity: major
Priority: P3
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: danijans03 at student.kau.se
The code below compiles but it shouldn't. A more complex version of this
problem caused dmd to segfault.
import std.stdio;
void main()
{
}
template ObjectException(T, U)
{
class T : Exception
{
private U instance;
public U data()
{
return instance;
}
this(char[] msg)
{
super(msg);
}
this(char[] msg, U object)
{
super(msg);
instance = object;
}
}
unittest
{
class ImlException
{
}
class test
{
}
mixin ObjectException!(ImlException, test);
test i = new test();
ImlException ex = new ImlException("Ok",i);
writefln(ex.msg);
}
}
--
More information about the Digitalmars-d-bugs
mailing list