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

           Summary: Compiler should 'soldier on' after template errors
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 2012-02-10 22:03:55 PST ---
At the start of TemplateInstance::semantic is this code:
    if (global.errors)
    {
        //printf("not instantiating %s due to %d errors\n", toChars(),
global.errors);
        if (!global.gag)
        {
            /* Trying to soldier on rarely generates useful messages
             * at this point.
             */
            fatal();
        }
It's a hack, really. This has the effect that after ANY error, any template
instantiation will abort compilation completely. Back in the Bad Old Days, when
the compiler soldiered on, it would spew reams of garbage and then crash. But
now, with all of the ErrorExp improvements, soldiering on does in fact generate
useful error messages.
If there have been errors in the template arguments, obviously it shouldn't
instantiate it, but there's no need to abort compilation completely. More
importantly, notice that it *does* continue if errors are gagged.  Aborting
compilation is hampering our ability to observe what it's doing.
Soldiering on will help make it more robust.

Simple example: this code should generate two errors, one for 'zoo' and one for
'roo'.

int foo(X)(X x) { return 6; }

void main()
{
  foo!(zoo)(5);
  foo!(double)(roo);
}

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

Reply via email to