[Bug c++/26471] no warning available when binding a temporary to a const reference member

2006-02-25 Thread pinskia at gcc dot gnu dot org
--- Comment #1 from pinskia at gcc dot gnu dot org 2006-02-25 19:57 --- First: Y y(X()); that declares a function rather than a variable. You want: Y y((X())); Second, this is called life time and there is no way for GCC to know that constructure's argument is used only for

[Bug c++/26471] no warning available when binding a temporary to a const reference member

2006-02-25 Thread o dot kullmann at swansea dot ac dot uk
--- Comment #2 from o dot kullmann at swansea dot ac dot uk 2006-02-25 20:15 --- Sure, those additional brackets I missed because I created this case from scratch (and then forgot about it). But the other points I don't see: I seems trivial for gcc to find this sort of error: Just

[Bug c++/26471] no warning available when binding a temporary to a const reference member

2006-02-25 Thread pinskia at gcc dot gnu dot org
--- Comment #3 from pinskia at gcc dot gnu dot org 2006-02-25 20:35 --- (In reply to comment #2) I seems trivial for gcc to find this sort of error: Just watch out for const reference members in classes, and then see whether they are bound to a temporary (gcc warns about this in

[Bug c++/26471] no warning available when binding a temporary to a const reference member

2006-02-25 Thread o dot kullmann at swansea dot ac dot uk
--- Comment #4 from o dot kullmann at swansea dot ac dot uk 2006-02-25 21:21 --- Y y((X())); How does GCC know that the temporary that holds X() is going to be stored in y? By the definition of Y, obviously. There seems to be a very special way of how GCC is parsing the input,