digitalmars.D.bugs - [Issue 9055] New: Compiler bails out on initializing a variable
- d-bugmail puremagic.com (23/23) Nov 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (17/17) Nov 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (9/9) Nov 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (10/10) Nov 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (15/18) Nov 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (20/20) Nov 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (43/43) Jan 04 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (11/11) Jan 04 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (8/25) Jan 04 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9055
- d-bugmail puremagic.com (35/35) Oct 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9055
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 --- 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: -------
Nov 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9055 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc 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: -------
Nov 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9055 Manfred Nowak <svv1999 hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- mime type| | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9055 --- 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: -------
Nov 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9055 ---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: -------
Nov 22 2012
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 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: -------
Nov 23 2012
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 | 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: -------
Jan 04 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9055 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: -------
Jan 04 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9055This 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: -------
Jan 04 2013
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 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: -------
Oct 06 2013