-H creates broken headers like the attached one. It contains for example spurious "else" keywords.
/opt/dmd/include/phobos/std/stdio.d(111): found 'else' instead of statement
/opt/dmd/include/phobos/std/stdio.d(138): found 'else' instead of statement
/opt/dmd/include/phobos/std/stdio.d(295): found 'else' instead of statement
/opt/dmd/include/phobos/std/stdio.d(298): found 'else' instead of statement
/opt/dmd/include/phobos/std/stdio.d(340): found 'bool' when expecting ';' following 'statement'
/opt/dmd/include/phobos/std/stdio.d(366): found 'else' instead of statement
/opt/dmd/include/phobos/std/stdio.d(374): found 'else' instead of statement
Comment #1 by devurandom — 2008-03-31T17:56:01Z
Created attachment 240
Example of broken header
PS: This header was generated like this: /var/tmp/portage/dev-lang/dmd-bin-2.012/work/dmd/bin/dmd -Istd/ -o- -c -H -Hfinclude/std/stdio.d std/stdio.d
Comment #2 by chris — 2008-04-11T10:52:17Z
Small example of -H producing broken output, DMD 1.028:
template Foo(bool bar)
{
void test()
{
static if(bar)
{ // Note the empty block.
}
else
{
}
}
}
// -H output:
// D import file generated from 'H.d'
template Foo(bool bar)
{
void test()
{
static if(bar)
else
}
}
Comment #3 by chris — 2008-04-11T11:18:48Z
Found another problem with -H:
template Foo()
{
void bar()
{
}
}
class Baz
{
mixin Foo foo;
alias foo.bar baz;
}
// -H output:
// D import file generated from 'H.d'
template Foo()
{
void bar()
{
}
}
class Baz
{
mixin Foo!(); // Note: no mixin identifier foo as it should.
alias foo.bar baz; // Now foo doesn't exist, error.
}
Comment #4 by devurandom — 2008-06-09T08:14:52Z
Issue is still present in 2.0.14.
Comment #5 by larsivar — 2008-06-09T08:32:36Z
Versions should stay at the earliest known.
Comment #6 by bugzilla — 2008-06-22T18:54:07Z
Fixed dmd 1.031 and 2.015
Comment #7 by devurandom — 2008-06-23T02:48:33Z
Created attachment 259
algorithm.d
Persists in 2.0.15, though in slightly different form.
To make this easier to check, you should include the version number of dmd which created the header file. Because of the recent Makefile changes, my fixes to bug #1940 did not apply anymore, which resulted in the system dmd being used to create the headers...
Compiling this sample:
---
import std.stdio;
void main(string[] args)
{
writefln("Hello world!");
}
---
Creates this output:
/opt/dmd/include/phobos/std/stdio.d(368): found 'bool' when expecting ';' following 'statement'
/opt/dmd/include/phobos/std/string.d(101): no identifier for declarator manifest
/opt/dmd/include/phobos/std/string.d(101): semicolon expected, not 'dchar'
/opt/dmd/include/phobos/std/string.d(102): no identifier for declarator manifest
/opt/dmd/include/phobos/std/string.d(102): semicolon expected, not 'dchar'
/opt/dmd/include/phobos/std/algorithm.d(86): no identifier for declarator manifest
/opt/dmd/include/phobos/std/algorithm.d(86): semicolon expected, not 'uint'
/opt/dmd/include/phobos/std/algorithm.d(736): found '!=' when expecting ')'
/opt/dmd/include/phobos/std/algorithm.d(736): found ')' when expecting ';' following 'statement'
/opt/dmd/include/phobos/std/algorithm.d(748): found 'else' instead of statement
/opt/dmd/include/phobos/std/algorithm.d(755): Declaration expected, not 'else'
/opt/dmd/include/phobos/std/algorithm.d(760): unrecognized declaration
/opt/dmd/include/phobos/std/c/stdlib.d(63): no identifier for declarator manifest
/opt/dmd/include/phobos/std/c/stdlib.d(63): semicolon expected, not 'int'
/opt/dmd/include/phobos/std/c/stdlib.d(63): Error: identifier 'manifest' is not defined
/opt/dmd/include/phobos/std/c/stdlib.d(63): Error: manifest is used as a type
/opt/dmd/include/phobos/std/c/stdlib.d(63): variable voids have no value
/opt/dmd/include/phobos/std/encoding.d(57): no identifier for declarator manifest
/opt/dmd/include/phobos/std/encoding.d(57): semicolon expected, not 'dchar'
/opt/dmd/include/phobos/std/traits.d(607): no identifier for declarator manifest
/opt/dmd/include/phobos/std/traits.d(607): semicolon expected, not 'byte'
Comment #8 by devurandom — 2008-06-23T02:51:16Z
> Because of the recent Makefile changes, my fixes to bug #1940 did not apply
> anymore, which resulted in the system dmd being used to create the headers...
To make this clear: This does not mean that the attached header, or the header used to make dmd fail were generated by dmd 2.014. After fixing my patch, the headers are generated by 2.015 again, which creates that slightly different, but still incorrect, output.