Thread overview
[Issue 1913] New: Template error message reports correct line # but wrong file
Mar 12, 2008
d-bugmail
Mar 25, 2008
d-bugmail
Jul 09, 2008
d-bugmail
Jul 10, 2011
Kenji Hara
March 12, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1913

           Summary: Template error message reports correct line # but wrong
                    file
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: webmaster@villagersonline.com


The code below actually has two problems with the error messages produced.

This bug is to report the fact that the second error message reports the wrong file name (although it reports the right line number).

dmd 2.012, Linux

BEGIN MODULE "a.d"
  import b;

  import std.stdio;

  template typeof_each(T,TPL...)
  {
    static if(TPL.length == 0)
      alias Tuple!(typeof(T)) typeof_each;
    else
      alias Tuple!(typeof(T), typeof_each!(TPL)) typeof_each;
  }

  template typeid_each(T,TPL...)
  {
    static if(TPL.length == 0)
      alias Tuple!(typeid(T)) typeid_each;
    else
      alias Tuple!(typeid(T), typeid_each!(TPL)) typeid_each;
  }

  void foo(ARGS_TPL...)(ARGS_TPL args)
  {
    writefln("", typeid_each!(typeof_each!(ARGS_TPL)));
  }

  void bar()
  {
    foo(',' , ',');
  }

BEGIN MODULE "b.d"
  template Tuple(TPL...)
  {
    alias TPL Tuple;
  }

END CODE

COMPILER OUTPUT
  Error: expression & _D10TypeInfo_a6__initZ is not a valid template value
argument
  b.d(16): template instance b.Tuple!(& _D10TypeInfo_a6__initZ) error
instantiating


-- 

March 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1913





------- Comment #1 from simen.kjaras@gmail.com  2008-03-25 17:25 -------
Simpler code to showcase the error. Bug is in message #1

BEGIN MODULE "a.d"

module a;
import b;

void main()
{
        int bar;
        foo!(bar) baz;
}

BEGIN MODULE "b.d"

module b;

struct foo(alias T)
{
        mixin T;
}

END CODE

COMPILER OUTPUT
a.d(5): mixin T isn't a template
a.d(7): template instance a.main.foo!(bar) error instantiating


-- 

July 09, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1913





------- Comment #2 from webmaster@villagersonline.com  2008-07-09 14:32 -------
The error in question (the one that had the wrong line number) went away.  So, I no longer have this problem.  However, since the error went away altogether, I cannot confirm that the erroneous filename reporting is actually fixed.  It is possible that maybe the problem that exposed it simply vanished.


-- 

July 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1913


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |k.hara.pg@gmail.com
         Resolution|                            |FIXED


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-07-09 20:13:48 PDT ---
As Russ says in comment #2, now Error message is correct (dmd 45cc9c5).
----
b.d(5): Error: mixin T isn't a template
a.d(7): Error: template instance a.main.foo!(bar) error instantiating
----

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