www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21481] New: presence of function template prevents diagnostic


          Issue ID: 21481
           Summary: presence of function template prevents diagnostic
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kdevel vogtner.de

from http://forum.dlang.org/thread/lhnvvkylevyuwotygjol forum.dlang.org

module A;
import std.stdio;

void bar (int s) { __PRETTY_FUNCTION__.writeln; }

import std.stdio;
import A;
alias bar = A.bar;

version (X) {
   void bar (T) (T t) { __PRETTY_FUNCTION__.writeln; }

void bar (int s) { __PRETTY_FUNCTION__.writeln; }

void main ()
   bar (1);

$ dmd -i foo
foo.d(13): Error: foo.bar called with argument types (int) matches both:
A.d(4):     A.bar(int s)
foo.d(9):     foo.bar(int s)

$ dmd -version=X -i foo
$ ./foo
void A.bar(int s)

Dec 13 2020