Bug 6963 – pure/nothrow inference doesn't work for function pointers

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-11-16T20:30:00Z
Last change time
2013-02-05T13:12:40Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2011-11-16T20:30:27Z
void foo(X)(X x) {} immutable void function(int) pure bar = &foo!(int); test.d(7): Error: cannot implicitly convert expression (& foo) of type void fun ction(int x) to immutable(void function(int) pure) Incidentally, this code: immutable nothrow pure bar = &foo!(int); compiles without error, but bar isn't pure nothrow!
Comment #1 by k.hara.pg — 2011-11-18T02:20:42Z
It doesn't occur if the declarations are in function scope. void foo(X)(X x) {} // doesn't work //immutable void function(int) pure bar1 = &foo!(int); //immutable nothrow pure bar2 = &foo!(int); void main() { // does work immutable void function(int) pure bar1 = &foo!(int); immutable nothrow pure bar2 = &foo!(int); }
Comment #2 by k.hara.pg — 2011-11-30T14:50:45Z
Comment #3 by github-bugzilla — 2012-11-08T01:23:13Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0c86463e012dc6f95d996e0d627ca177a23e730a fix Issue 6963 - pure/nothrow inference doesn't work for function pointers If the VarDeclaration is not a compile time constant, defer semantic of it's initializer. https://github.com/D-Programming-Language/dmd/commit/f6a212814630113441a567777a307a197400b922 Merge pull request #544 from 9rnsr/fix6963 Issue 6332 & 6356 & 6963 - Ignite pure/nothrow inference for template function
Comment #4 by andrej.mitrovich — 2013-02-05T13:12:40Z
Seems fixed now.