"Fossies" - the Fresh Open Source Software Archive

Member "ldc-1.7.0-src/tests/d2/dmd-testsuite/runnable/a21.d" (5 Jan 2018, 348 Bytes) of package /linux/misc/ldc-1.7.0-src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) D source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // EXTRA_SOURCES: imports/a21a.d
    2 // PERMUTE_ARGS:
    3 
    4 import std.stdio;
    5 import imports.a21a;
    6 
    7 
    8 template BadMixin()
    9 {
   10     int badFunc()
   11     {
   12         printf("badFunc\n");
   13         return 2;
   14     }
   15 }
   16 
   17 
   18 int main()
   19 {
   20     int i;
   21     auto x = new SomeClass;
   22     i = x.goodFunc();
   23     assert(i == 1);
   24     i = x.badFunc();
   25     assert(i == 2);
   26 
   27     return 0;
   28 }
   29