[Issue 11919] New: GitHub HEAD regression for getAttributes trait (DMD CORE DUMP)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 13 09:36:56 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11919

           Summary: GitHub HEAD regression for getAttributes trait (DMD
                    CORE DUMP)
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: puneet at coverify.org


--- Comment #0 from Puneet Goel <puneet at coverify.org> 2014-01-13 09:36:53 PST ---
Reduced with dustmite -- line 7 of foobar.d does not make sense to me, but
compiler does not seem to mind it. In my original (50000 lines) code, I have
legal code and am getting same error with dmd HEAD. dmd-2.064 works fine with
original code.

When I compile with dmd 2.064, the following reduced code compiles and runs.
When compiled with latest Github HEAD, I get a dmd CORE DUMP and before that a
compiler error that does not come with dmd-2.064.

$ dmd -c test.d
test.d(4): Error: undefined identifier foo, did you mean variable zoo?
dmd: interpret.c:310: static int CompiledCtfeFunction::walkAllVars(Expression*,
void*): Assertion `0' failed.
Aborted (core dumped)


Also when I comment out foobar.d line 7, dmd HEAD gives the same error again
with a CORE DUMP. With line 7 commented, dmd-2.064 also behaves in a strange
fashion. 

$ dmd-2.064 test.d
test.d(4): Error: Cannot interpret foo at compile time
test.d(4): Error: Cannot interpret foo at compile time


// foobar.d
module foobar;                                   // 1
void doBar(T)(T t) {                             // 2
  static if(t.tupleof.length)                    // 3
    if(zoo!t.length == 0){}                      // 4
  static if(is(T B == super)                     // 5
            && is(B[0] == class)                 // 6
            && is(B[])                           // 7
            ) {                                  // 8
    B[0] b = t;                                  // 9
    doBar(b);                                    // 10
  }                                              // 11
}                                                // 12
template zoo(alias t) {                          // 13
  enum zoo = __traits(getAttributes, t.tupleof); // 14
}                                                // 15

// test.d
import foobar;                                   // 1
enum foo;                                        // 2
class Foo {                                      // 3
  @foo bool _foo;                                // 4
}                                                // 5
class Bar: Foo {}                                // 6
void main() {                                    // 7
  auto bar = new Bar();                          // 8
  bar.doBar;                                     // 9
}                                                // 10

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


More information about the Digitalmars-d-bugs mailing list