[Bug c++/20332] New: poor diagnostic

igodard at pacbell dot net gcc-bugzilla@gcc.gnu.org
Sat Mar 5 10:20:00 GMT 2005

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


           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


More information about the Gcc-bugs mailing list