[Bug c++/17821] New: Poor diagnostic

igodard at pacbell dot net gcc-bugzilla@gcc.gnu.org
Mon Oct 4 00:25:00 GMT 2004


struct A {
    A(int i) {}
    };
struct B {
    int i;
    };
struct C {
    B* p;
    };
int main() {
    C c;
    A(c.p->i);
    A(c.p.i);
    return 0;
    }

gets you:

~/ootbc/members/src$ c++ foo.cc
foo.cc: In function `int main()':
foo.cc:13: error: expected primary-expression before '(' token
foo.cc:13: error: `i' has not been declared
foo.cc:13: error: request for member of non-aggregate type before ')' token

when the actual problem is a wrong dereference level ("." instead of "->")

-- 
           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=17821



More information about the Gcc-bugs mailing list