Bug 10319 – @safe/pure/nothrow error should print fully qualified name
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-09T22:32:00Z
Last change time
2013-06-10T02:25:55Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2013-06-09T22:32:31Z
Test case:
void foo() {}
void bar(T)()
{
static int g; g = 10; // impure
int x; auto p = &x; // system
throw new Exception(""); // throwing
}
@safe pure nothrow void main() // L10
{
foo(); // L12
bar!int(); // L13
}
Current error output:
test.d(12): Error: pure function 'D main' cannot call impure function 'test.foo'
test.d(12): Error: safe function 'D main' cannot call system function 'test.foo'
test.d(13): Error: pure function 'main' cannot call impure function 'bar'
test.d(13): Error: safe function 'D main' cannot call system function 'test.bar!(int).bar'
test.d(12): Error: foo is not nothrow
test.d(13): Error: bar is not nothrow
test.d(10): Error: function D main 'main' is nothrow yet may throw
Expected error output:
test.d(12): Error: pure function 'D main' cannot call impure function 'test.foo'
test.d(12): Error: safe function 'D main' cannot call system function 'test.foo'
test.d(13): Error: pure function 'D main' cannot call impure function 'test.bar!(int).bar'
test.d(13): Error: safe function 'D main' cannot call system function 'test.bar!(int).bar'
test.d(12): Error: 'test.foo' is not nothrow
test.d(13): Error: 'test.bar!(int).bar' is not nothrow
test.d(10): Error: function 'D main' is nothrow yet may throw