In: struct bar {}; void foo1() { bar& b = bar(); } void foo(bar& b = bar()) {}
you get: ~/ootbc/members/src$ g++ foo.cc foo.cc: In function `void foo1()': foo.cc:3: error: invalid initialization of non-const reference of type 'bar&' from a temporary of type 'bar' foo.cc: At global scope: foo.cc:5: error: default argument for `bar&b' has type `bar' for essentially the same error. The second diagnostic is distinctly inferior Ivan -- Summary: poor diagnostic Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20332