[Issue 1454] New: IFTI cant deduce parameter if alias argument used

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 29 18:40:32 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1454

           Summary: IFTI cant  deduce parameter if alias argument used
           Product: D
           Version: 1.020
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com


If you have a templated struct like
  struct Base(T) {} 

and you create an alias of that
  alias Base Alias;

Then using the alias as an argument will confuse IFTI:
  void foo(T)(Alias!(T) x) { }

  Alias!(float) b;
  Alias!(float) a;
  foo(b);  // IFTI fails
  foo(a);  // IFTI fails

  foo!(float)(b) // ok
  foo!(float)(a) // ok

IFTI works fine for both if Base!(T) is used as the function argument.

Why would you want to do this? I'm trying to port some C++ code.  This code
uses a lot of trivial struct inheritance to create a related set of value types
(basically iterator types).  They all derive from one struct Base(T), and the
derived things don't actually add anything new.  The derivation is used only to
get a distinct type with a common ancestor.  So I'm trying to at least preserve
the type structure in anticipation of the day when D gets a better way to do
this.


-- 



More information about the Digitalmars-d-bugs mailing list