Hi, The code below produces a warning about returning a reference to a temporary when using enum types for the qMin method. It works fine when using primitive types or classes instead of enums. Fortunately it's rather easy to work around the warning :) Best regards, Lars enum Foo { A, B }; template<typename T> const T &qMin(const T &a, const T &b) { return a < b ? a : b; } int main(int, char **) { Foo f = A; Foo g = B; Foo h = qMin(f, g); return 0; }
-- Summary: Wrong warning about returning a reference to a temporary Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lars at trolltech dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19199