www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4118] New: std.conv.to!SomeStruct("hello") crashes compiler

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4118

           Summary: std.conv.to!SomeStruct("hello") crashes compiler
           Product: D
           Version: 2.041
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: michel.fortin michelf.com



14:15:55 EDT ---
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");
    }
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 24 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4118


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
         OS/Version|Mac OS X                    |All



10:57:58 PDT ---
It dies on Windows, too, so it's not an OSX specific problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 01 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4118




11:45:08 PDT ---
changeset 462 - at least it gives an error message now

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 01 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4118




15:20:03 EDT ---
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");
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 01 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4118


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 09 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4118


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED



15:07:45 PST ---
Can't repro on 2.051, presumed fixed in action.

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