[Bug c++/17788] New: poor diagnostic for missing reference initializer

rth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Oct 1 23:59:00 GMT 2004


Compiling the following (invalid) code:

class foo {
public:
        foo();
};

class bar: public foo {
private:
        int &a;
};

foo::foo() {
}

int main(int argc, char **argv)
{
        bar x;
}

Returns:
test.cpp:16: error: no matching function for call to `bar::bar ()'
test.cpp:9: note: candidates are: bar::bar (const bar &)

Rather than:
test.cpp:14: error: structure `x' with uninitialized reference members

(which you get when bar doesn't inherit foo).

-- 
           Summary: poor diagnostic for missing reference initializer
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17788



More information about the Gcc-bugs mailing list