Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
March 18, 2004 Cast causes access violation | ||||
---|---|---|---|---|
| ||||
I've got a class called Regex wich is an subclass of the interface Automate. In some function I have a parameter which takes an automate. public void fromAutomate(in Automate from) { Regex ex = (Regex)from; } I am sure this is a Regex because running the interface methods work as expected. However, casting the Automate to the regex causes an access violation. Please help, Johnny |
March 18, 2004 Re: Cast causes access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johnny | I think you should reduce this to a minimum self-contained example which compiles and fails in this manner (up to 20 lines of code) and try to post it with a [bug] in subject line. Walter needs such to find bugs and maintain a set of tests.
Else i don't see what would be causing it.
-eye
Johnny schrieb:
> I've got a class called Regex wich is an subclass of the interface Automate. In
> some function I have a parameter which takes an automate.
>
> public void fromAutomate(in Automate from)
> {
> Regex ex = (Regex)from;
> }
>
> I am sure this is a Regex because running the interface methods work as
> expected. However, casting the Automate to the regex causes an access violation.
>
> Please help,
> Johnny
>
>
|
March 18, 2004 [bug] Re: Cast causes access violation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | public interface Automate {} public class NDFA : public Automate { public void fromAutomate(in Automate from) { printf("%d\n", (Regex)from); } } public class Regex: public Automate {} int main() { Regex regex = new Regex(); NDFA ndfa = new NDFA(); ndfa.fromAutomate(regex); return 0; } and all he prints is a 0 In article <c3c42t$1fg$1@digitaldaemon.com>, Ilya Minkov says... > >I think you should reduce this to a minimum self-contained example which compiles and fails in this manner (up to 20 lines of code) and try to post it with a [bug] in subject line. Walter needs such to find bugs and maintain a set of tests. > >Else i don't see what would be causing it. > >-eye > >Johnny schrieb: >> I've got a class called Regex wich is an subclass of the interface Automate. In some function I have a parameter which takes an automate. >> >> public void fromAutomate(in Automate from) >> { >> Regex ex = (Regex)from; >> } >> >> I am sure this is a Regex because running the interface methods work as expected. However, casting the Automate to the regex causes an access violation. >> >> Please help, >> Johnny >> >> |
Copyright © 1999-2021 by the D Language Foundation