[Issue 20507] New: Debug statements affect inference of templated functions attributes
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 15 15:32:46 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20507
Issue ID: 20507
Summary: Debug statements affect inference of templated
functions attributes
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: moonlightsentinel at disroot.org
debug statements are allowed to violate @safe, pure, @nogc and nothrow
(allthough the latter is not implemented right now). But they influence the
attribute interference:
----------------------------------------------
void main() pure /* nothrow */ @safe @nogc
{
debug foo();
bar!()();
}
void foo() @system
{
// Just to be sure its neither @nogc, pure or nothrow
__gshared int counter = 0;
if (counter++)
throw new Exception(new immutable(char)[counter]);
}
void bar()()
{
debug foo();
}
----------------------------------------------
..\debugging.d(4): Error: @safe function D main cannot call @system function
debugging.bar!().bar
..\debugging.d(16): debugging.bar!().bar is declared here
..\debugging.d(4): Error: @nogc function D main cannot call non- at nogc function
debugging.bar!().bar
----------------------------------------------
The debug statement caused bar to become @system, non- at nogc and non-nothrow.
--
More information about the Digitalmars-d-bugs
mailing list