Bug 12447 – variadic template functions hijack all eponymous enum and alias template overloads

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-23T16:27:00Z
Last change time
2015-02-18T03:38:47Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
2krnk

Comments

Comment #0 by 2krnk — 2014-03-23T16:27:05Z
see following example code. the two 'test' templates work fine by themselves. if they are in the same module, however, the eponymous enum template does not work anymore. instead the compiler tries to instantiate the variadic template - and fails. same issue with eponymous alias templates. this should not happen as o the two templates have very different signatures, i.e. completely incompatible argument lists ( zero vs >0 arguments) o the string parameter is more specialized than the take-all tuple example code: ============= // cannot be used with function arguments: enum test(string str ) = "templated enum 'test' used with "~str; // cannot be called with less than 1 function arguments: string test (T ...)( T strs ) if( strs.length ) { return "templated function 'test' called with "~strs[0]; } // enum epo = test!("foo"); // use eponymous enum // if commented in: // Error: tuple T is used as a type // in line 5 = string test (T ...)( T strs ) enum vari = test("bar"); // use templated/variadic function void main(string[] args) { import std.stdio; // writeln( epo ); writeln( vari ); }
Comment #1 by k.hara.pg — 2014-10-26T03:59:48Z
Comment #2 by github-bugzilla — 2014-10-26T08:51:28Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/68e8c9493a6970eab33569edec8e40253200cfc0 fix Issue 12447 - variadic template functions hijack all eponymous enum and alias template overloads https://github.com/D-Programming-Language/dmd/commit/c6289aaaed66f86de0950954c953f45b0f4f342d Merge pull request #4091 from 9rnsr/fix12447 Issue 12447 & 11915 & 11916 - fix overload resolution issue around IFTI and out parameter
Comment #3 by github-bugzilla — 2015-02-18T03:38:47Z
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/68e8c9493a6970eab33569edec8e40253200cfc0 fix Issue 12447 - variadic template functions hijack all eponymous enum and alias template overloads https://github.com/D-Programming-Language/dmd/commit/c6289aaaed66f86de0950954c953f45b0f4f342d Merge pull request #4091 from 9rnsr/fix12447