Comment #0 by michel.fortin — 2010-04-24T11:15:55Z
The program below crashes with "Bus error" when trying to compile from the command line on Mac OS X 10.6.3. I know this was not crashing the compiler a few versions ago (some time early january 2010).
---
import std.conv;
struct SomeStruct { }
void main() {
auto s = to!SomeStruct("hello");
}
---
It is a real problem for me that it crashes the compiler since I'm using a __traits(compile, ...) with something similar for conditional compilation, and this does not work anymore.
---
import std.conv;
struct SomeStruct { }
void main() {
static if (__traits(compiles, to!SomeStruct("hello"))) {
auto s = to!SomeStruct("hello");
}
}
---
Comment #1 by bugzilla — 2010-05-01T10:57:58Z
It dies on Windows, too, so it's not an OSX specific problem.
Comment #2 by bugzilla — 2010-05-01T11:45:08Z
changeset 462 - at least it gives an error message now
Comment #3 by michel.fortin — 2010-05-01T12:20:03Z
Ah, great. I can use it now as it no longer crashes.
But I don't think it should give an error, it should just not match the given template.
The error you added gives a false positive in this case:
---
struct SomeStruct { }
int test(T : T[X], X)(X x) {
return 1;
}
int test(T : SomeStruct, X)(X x) {
return 1;
}
void main() {
auto s = test!SomeStruct("hello");
}
---