Bug 13745 – Circular template attributes inference does not work

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2014-11-18T00:39:32Z
Last change time
2019-04-12T14:46:21Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Илья Ярошенко
See also
https://issues.dlang.org/show_bug.cgi?id=12542

Comments

Comment #0 by ilyayaroshenko — 2014-11-18T00:39:32Z
void foo(T)(T i) { if(i) bar(--i); } void bar(T)(T i) { foo(i); } @safe unittest { foo(10u); } ======== test6_2.d(13): Error: safe function 'test6_2.__unittestL11_1' cannot call system function 'test6_2.foo!uint.foo'
Comment #1 by hsteoh — 2014-11-18T00:53:19Z
Just wanted to add, that while this test case may look artificial, it reflects actual usage in Phobos where you may have one generic function instantiated in such a way that further down the road it gets re-instantiated. Such chains of dependencies are often buried deep within Phobos modules implicitly, due to the generic nature of most of Phobos modules, so this is a real, practical problem.
Comment #2 by hsteoh — 2014-11-18T00:54:50Z
Related: - https://github.com/D-Programming-Language/phobos/pull/2732 (first 2 commits of this PR exhibits this problem after a change in import) - https://github.com/D-Programming-Language/phobos/pull/2737 (comments explain how to reproduce the problem)
Comment #3 by github-bugzilla — 2014-11-22T09:50:56Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/591d616dd5478b31e94beaa00cfaefeebf0a8045 avoid triggering issue 13745 in further improvements to come https://github.com/D-Programming-Language/phobos/commit/03512786f2bfc86c2820e6688baae86aec637d10 Merge pull request #2737 from 9il/exc avoid triggering issue 13745 in further improvements to come
Comment #4 by github-bugzilla — 2015-02-18T03:40:01Z