Bug 11312 – [REG2.063] Avoid auto-dereference for UFCS functions

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-21T03:10:00Z
Last change time
2014-08-28T04:10:20Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-10-21T03:10:05Z
Here's an example of UFCS with a simple int*: ----- int* getPtr() { return null; } int getValue(int*) { return 0; } void main() { int* op = getPtr(); int x = op.getValue(); // works ok } ----- Now the following is an example of where you're interfacing with some C code, and you want to allow UFCS-style syntax to make it easier to use the C library. The C library defines opaque struct types and only allows manipulation through pointers and functions: ----- struct Struct; extern(C) Struct* getStruct() { return null; } extern(C) int getValue(Struct*) { return 0; } void main() { Struct* op = getStruct(); int x = op.getValue(); // error } ----- This errors with: test.d(10): Error: struct Struct is forward referenced I think this might just be a compiler bug. There's no point in dereferencing the pointer here because the function call would not match (getValue is typed as Struct*, not Struct).
Comment #1 by andrej.mitrovich — 2013-10-21T03:20:06Z
Update: The code used to work in 2.062, but fails to work since 2.063.2. Is this a regression?
Comment #2 by k.hara.pg — 2014-08-26T12:52:41Z
Comment #3 by github-bugzilla — 2014-08-26T13:38:47Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4723d594af9dd8649f1f9068d53549c3df05beb8 fix Issue 11312 - Avoid auto-dereference for UFCS functions https://github.com/D-Programming-Language/dmd/commit/a84da310eb3adab3d3536e5414cea19709a8ce83 Merge pull request #3900 from 9rnsr/fix11312 Issue 11312 - Avoid auto-dereference for UFCS functions
Comment #4 by k.hara.pg — 2014-08-26T13:50:36Z
(In reply to Andrej Mitrovic from comment #1) > Update: The code used to work in 2.062, but fails to work since 2.063.2. Is > this a regression? I confirmed that is a regression.
Comment #5 by github-bugzilla — 2014-08-28T04:10:20Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8b6765c22f852d59db9c01c41b65dabadb7430af Merge pull request #3900 from 9rnsr/fix11312 Issue 11312 - Avoid auto-dereference for UFCS functions