digitalmars.D.learn - incomprehensible return error bug?
enum { A = 0, B, C } void func(){ return A; } void main() { } main.d(1): Error: long has no effect in expression (0) Is this a bug?
Jan 24 2010
strtr Wrote:enum { A = 0, B, C } void func(){ return A; } void main() { } main.d(1): Error: long has no effect in expression (0) Is this a bug?This error also points to the enum which is probably incorrectly used somewhere s_def(32) Error: cannot implicitly convert expression (5) of type int to S Still searching for the original bug btw :(
Jan 24 2010
strtr Wrote:This error also points to the enum which is probably incorrectly used somewhere s_def(32) Error: cannot implicitly convert expression (5) of type int to S Still searching for the original bug btw :(Found it, also a return type mismatch problem; returning a enum member where the encapsulating struct should have been returned.
Jan 24 2010
strtr Wrote:strtr Wrote:BTW, the function says void ( no return ) and you try tu return an integer ( form a enum ) yea, is incomprehensible but is not wrongThis error also points to the enum which is probably incorrectly used somewhere s_def(32) Error: cannot implicitly convert expression (5) of type int to S Still searching for the original bug btw :(Found it, also a return type mismatch problem; returning a enum member where the encapsulating struct should have been returned.
Jan 24 2010
g Wrote:strtr Wrote:also , why in the world would you try to convert a manifest constant into a structstrtr Wrote:This error also points to the enum which is probably incorrectly used somewhere s_def(32) Error: cannot implicitly convert expression (5) of type int to S Still searching for the original bug btw :(Found it, also a return type mismatch problem; returning a enum member where the encapsulating struct should have been returned.
Jan 24 2010
g Wrote:g Wrote:Oh, you misunderstand (I was probably not clear enough :) I know the bugs in my program were mine, but I think that the incomprehensibility of the error is a bug in dmd. They should point of type mismatch location, not to the enum line.strtr Wrote:also , why in the world would you try to convert a manifest constant into a structstrtr Wrote:This error also points to the enum which is probably incorrectly used somewhere s_def(32) Error: cannot implicitly convert expression (5) of type int to S Still searching for the original bug btw :(Found it, also a return type mismatch problem; returning a enum member where the encapsulating struct should have been returned.
Jan 25 2010