www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12704] New: typeof function literal incorrectly infers

https://issues.dlang.org/show_bug.cgi?id=12704

          Issue ID: 12704
           Summary: typeof function literal incorrectly infers attributes
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
void foo()  system;
alias FuncLitT = typeof(function() { foo(); });
static assert(is(FuncLitT == void function()  system));
CODE

dmd -c bug
----
bug.d(3): Error: static assert  (is(void function() pure  safe == void
function()  system)) is false
----

Interestingly nothrow is inferred correctly, only pure and  safe are broken.
Might be related to bug 12561.

--
May 05 2014