Thread overview | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 22, 2012 [Issue 9055] New: Compiler bails out on initializing a variable | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9055 Summary: Compiler bails out on initializing a variable Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: svv1999@hotmail.com --- Comment #0 from Manfred Nowak <svv1999@hotmail.com> 2012-11-22 04:11:31 PST --- Created an attachment (id=1164) the source On compiling with the `-debug' option, i.e. initializing the variable, the compiler evokes an exception. Without `-debug', i.e. _not_ initializing the variable, compilation ends flawlessly. -manfred -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 22, 2012 [Issue 9055] Compiler bails out on initializing a variable | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2012-11-22 04:21:03 PST --- Is this a valid reduction of your code? class Foo { int bar() { return 0; } int x = bar(); } void main() {} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 22, 2012 [Issue 9055] Compiler bails out on initializing a variable | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 Manfred Nowak <svv1999@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #1164|application/octet-stream |text/plain mime type| | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 22, 2012 [Issue 9055] Compiler bails out on initializing a variable | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 --- Comment #2 from Manfred Nowak <svv1999@hotmail.com> 2012-11-22 04:42:51 PST --- My text seems to be lost. Retry: On compiling with `-debug' dmd 2.060 evokes an exception on winXp x86 with all updates. Without `-debug', i.e without initializing the variable, no comülaints. -manfred -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 22, 2012 [Issue 9055] Compiler bails out on initializing a variable | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 --- Comment #3 from Manfred Nowak <svv1999@hotmail.com> 2012-11-22 05:09:15 PST --- (In reply to comment #1) > Is this a valid reduction of your code? > int bar() { > int x = bar(); Not at first glance. 1) In your code the missing `this' is declared as the root of the bug report. In my code `this' is present. 2) In your code reversing the lexical sequence of call and declaration does not change the error message. In my code reversing eliminates the bailing out. In addition no error is reported. -manfred -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 23, 2012 [Issue 9055] [CTFE] Compiler segfaults on paren-free auto-return forward referenced member function call on nonexistent 'this' receiver | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 timon.gehr@gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |CTFE CC| |timon.gehr@gmx.ch Summary|Compiler bails out on |[CTFE] Compiler segfaults |initializing a variable |on paren-free auto-return | |forward referenced member | |function call on | |nonexistent 'this' receiver --- Comment #4 from timon.gehr@gmx.ch 2012-11-23 05:53:32 PST --- Reduced test case: class C{ enum a=this.b; auto b(){ return 0; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 04, 2013 [Issue 9055] Compiler segfaults on forward reference to auto-return member function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|CTFE |ice Summary|[CTFE] Compiler segfaults |Compiler segfaults on |on paren-free auto-return |forward reference to |forward referenced member |auto-return member function |function call on | |nonexistent 'this' receiver | --- Comment #5 from Don <clugdbug@yahoo.com.au> 2013-01-04 02:00:12 PST --- This is not a CTFE bug. Here is an example which doesn't use CTFE, properties, or invalid use of 'this': --- class C { enum a = typeof(this.b()).init; static auto b(){ return 0; } } --- If in any of these examples you replace this.b() by simply b(), you get a "forward reference to b" error message. Here's a basic patch to do the same thing in this case. I'm not really happy with it though, the errors for b() and this.b() should be generated in the same function. -- a/src/expression.c +++ b/src/expression.c @@ -929,6 +929,11 @@ Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf, if (!tf->next && fd->inferRetType) { TemplateInstance *spec = fd->isSpeculative(); + if ( fd->semanticRun < PASSsemanticdone ) + { // We haven't run semantic() yet, eg bug 9055. + error(loc, "forward reference to %s", fd->toChars()); + return Type::terror; + } int olderrs = global.errors; // If it isn't speculative, we need to show errors unsigned oldgag = global.gag; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 04, 2013 [Issue 9055] Compiler segfaults on forward reference to auto-return member function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 --- Comment #6 from Don <clugdbug@yahoo.com.au> 2013-01-04 02:04:17 PST --- Better test case: class Bug9055 { typeof( Bug9055.b() ) x; auto b(){ return 0; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 04, 2013 [Issue 9055] Compiler segfaults on forward reference to auto-return member function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 --- Comment #7 from timon.gehr@gmx.ch 2013-01-04 10:22:07 PST --- (In reply to comment #5) > This is not a CTFE bug. Here is an example which doesn't use CTFE, properties, or invalid use of 'this': > --- > class C > { > enum a = typeof(this.b()).init; > static auto b(){ return 0; } > } > > --- > If in any of these examples you replace this.b() by simply b(), you get a > "forward reference to b" error message. > But forward references are allowed. This is another bug. > Here's a basic patch to do the same thing in this case. I'm not really happy > with it though, the errors for b() and this.b() should be generated in the same > function. > ... Both cases are valid D code. No error should be generated in either case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 07, 2013 [Issue 9055] Compiler segfaults on forward reference to auto-return member function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9055 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |WORKSFORME --- Comment #8 from Walter Bright <bugzilla@digitalmars.com> 2013-10-06 23:59:42 PDT --- The attachment code: --------------------------- import std.array: Appender; class Silent{ debug private Appender!string retval= this.ini; else private Appender!string retval; auto ini(){ return Appender!string(""); } } void main(){ } -------------------------- dmd test test.d(8): Error: constructor std.array.Appender!string.Appender.this (char[] arr) is not callable using argument types (string) dmd test -debug test.d(8): Error: constructor std.array.Appender!string.Appender.this (char[] arr) is not callable using argument types (string) --------------------------- No seg faults on this or the other examples. If there's some other issue, please open a separate issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation