www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6310] New: Missing "template instantiation" traceback when an error happens in the template parameter of an alias.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6310

           Summary: Missing "template instantiation" traceback when an
                    error happens in the template parameter of an alias.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: kennytm gmail.com


--- Comment #0 from kennytm gmail.com 2011-07-14 01:05:17 PDT ---
(I believe there's a duplicate, but I can't find it.)

Test case
--------------------------------------
template RT(alias f) {
    alias int RT;
}
template F(T) {
    alias RT!(T.dsfsdf) X;  // line 5
}
pragma(msg, F!(int)); // line 7
--------------------------------------
x.d(5): Error: no property 'dsfsdf' for type 'int'
--------------------------------------

There should be another error

x.d(7): Error: template instance x.F!(int) error instantiating

Many Phobos template e.g. ForeachType suffer from this missing traceback. The
error doesn't happen in D1, apparently.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 14 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6310



--- Comment #1 from kennytm gmail.com 2011-07-14 01:55:44 PDT ---
More sophisticated test case which may be due to a different cause.

--------------------------------------
template SL () {
    enum SL = 1;
}
template RT(alias T) if (SL!() == 1) {
    alias int RT;
}
template F(T) {
    alias RT!({ return T.init; }) F;  // line 8
}
pragma(msg, F!(void)); // line 10
--------------------------------------
x.d(8): Error: void does not have an initializer
x.d(8): Error: void does not have a default initializer
--------------------------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 14 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6310



--- Comment #2 from kennytm gmail.com 2011-07-14 13:36:08 PDT ---
4 more test cases: replace the contents of RT!(...) in the two comments by
'[T.init, T.init]' and 'void'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 14 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6310



--- Comment #3 from kennytm gmail.com 2011-07-20 03:22:10 PDT ---
One more test case.

---------------------------
void f()() {}
 safe int g(alias key)() {
    typeof(key(0)) k;       // line 3.
    f();
    return 0;
}
void main() {
    g!((int x) {
        auto y = &x + 1;
        return 0;
    })();
}
---------------------------
x.d(3): Error: safe function 'g' cannot call system delegate '__dgliteral1'
---------------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 20 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6310


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Kenji Hara <k.hara.pg gmail.com> 2013-09-16 01:16:54 PDT ---
Traceback issue has been fixed from 2.059.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2013