digitalmars.D.bugs - [Issue 3127] New: 'unreachable code' warning destroys delegate literal type inference
- d-bugmail puremagic.com (46/46) Jul 02 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3127
- d-bugmail puremagic.com (17/17) Jul 02 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3127
- d-bugmail puremagic.com (10/11) Jul 03 2009 the code wouldn't compile anyway even if it didn't spit out the bogus
- d-bugmail puremagic.com (11/11) Feb 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3127
http://d.puremagic.com/issues/show_bug.cgi?id=3127
Summary: 'unreachable code' warning destroys delegate literal
type inference
Product: D
Version: unspecified
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: diagnostic
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: clugdbug yahoo.com.au
D1 and D2. Compile with -w.
===========
void bar(real delegate(real) f) { }
void foo() {
return;
assert(0);
}
void main() {
bar( (real x){ return x; });
}
===========
Output with DMD1.045:
C:\dev>dmd -w bug
warning - bug.d(5): Error: statement is not reachable
bug.d(9): Error: function bug.bar (real delegate(real)) does not match
parameter
types (int delegate(real x))
bug.d(9): Error: cannot implicitly convert expression (__dgliteral1) of type
int
delegate(real x) to real delegate(real)
On DMD2.030, the type is 'void' instead:
C:\dev>dmd -w bug
warning - bug.d(5): Error: statement is not reachable
bug.d(9): Error: function bug.bar (real delegate(real) f) does not match
paramet
er types (void delegate(real x))
bug.d(9): Error: cannot implicitly convert expression (__dgliteral1) of type
voi
d delegate(real x) to real delegate(real)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3127
Jarrett Billingsley <jarrett.billingsley gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jarrett.billingsley gmail.c
| |om
2009-07-02 08:52:35 PDT ---
I'm not sure if this is valid, only because DMD treats warnings as errors, and
the code wouldn't compile anyway even if it didn't spit out the bogus
subsequent error. I've had it spit out dumb semantic errors like this after
other errors, and errors after the first are usually not to be trusted anyway..
It's kind of like how DMD sets the type of invalid expressions to 'int' and
then marches on, giving you all sorts of dumb errors that don't actually mean
anything.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3127I'm not sure if this is valid, only because DMD treats warnings as errors, andthe code wouldn't compile anyway even if it didn't spit out the bogus subsequent error. If it were in the same function, I would agree. But in this case, I can't see _any_ reason for the error to propagate from one function to an unrelated one. It's an indication that something's wrong. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3127
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Fixed in D1 in DMD1.046, and in D2, sometime before D2.035.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2010









d-bugmail puremagic.com 