February 20, 2003 warning 11 is missing or depends on unrelated error | ||||
---|---|---|---|---|
| ||||
struct A { int a; A(int j) : a(j) {}; }; // non-const reference argument announces intention to change argument void f(A& j) {j.a= 0;} A sum(A j, A k) {return A(j.a+k.a);} main() { j= 1; // error: undefined identifier (any error will do) f( A(1) ); // should get warning 11 but don't f( sum(A(2),A(3)) ); // should get warning 11 but don't unless prior error } The last two lines in main() both deserve warning 11 "non-const reference initialized to temporary". When I compile the program only the last line gets the warning. If I fix the error on the first line of main then neither line gets a warning. This is with version 8.32.17n of the compiler and all compiler flags defaulted. Steve Strand |
February 20, 2003 Re: warning 11 is missing or depends on unrelated error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steve Strand | I've logged the bug, thanks. -Walter |
Copyright © 1999-2021 by the D Language Foundation