Bug 15777 – Premature expansion of overload set in tuples

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-07T16:00:52Z
Last change time
2025-02-18T22:42:19Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Vladimir Panteleev

Comments

Comment #0 by dlang-bugzilla — 2016-03-07T16:00:52Z
/////////////////////// a.d ////////////////////// void fun() {} /////////////////////// b.d ////////////////////// void fun() {} ///////////////////// test.d ///////////////////// alias AliasSeq(X...) = X; template funA() { import a; alias funA = fun; } template funB() { import b; alias funB = fun; } template funAB() { import a; import b; alias funAB = fun; } void test(alias tpl)() { alias seq = AliasSeq!(tpl!()); foreach (i, n; seq) pragma(msg, __traits(identifier, seq[i])); } void main() { test!funA; test!funB; test!funAB; } ////////////////////////////////////////////////// The AliasSeq iteration works when seq is a single function, but when it's an overload set, you get an error: test.d(25): Error: variable test.test!(funAB).test.n variables cannot be of type void test.d(25): Error: b.fun at b.d(1) conflicts with a.fun at a.d(1) test.d(25): Error: expression fun() is void and has no value fun test.d(33): Error: template instance test.test!(funAB) error instantiating
Comment #1 by dlang-bugzilla — 2016-03-10T14:18:48Z
Comment #2 by k.hara.pg — 2016-03-24T15:18:18Z
Comment #3 by github-bugzilla — 2018-02-10T12:59:10Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/60ebdebc7cad480e4a0c3f97951e68d8d7bd8350 fix Issue 15777 - Premature expansion of overload set in tuples https://github.com/dlang/dmd/commit/0a111c872067b7c22bf7cea3f5ff2e1ce3f746a8 Merge pull request #7700 from ibuclaw/fix15777 fix Issue 15777 - Premature expansion of overload set in tuples merged-on-behalf-of: Mike Franklin <[email protected]>
Comment #4 by dlang-bot — 2025-02-18T22:42:19Z
dlang/phobos pull request #10641 "Remove obsolete workaround" was merged into master: - 752f3fd0c5ad4594b9f11fefb717eda6810f926d by Inkrementator: Remove obsolete workaround For resolved bugzilla issue 15777 https://github.com/dlang/phobos/pull/10641