Skip to content

diagnostic for referring to nested class before that type is complete refers to wrong type #11771

@llvmbot

Description

@llvmbot
Bugzilla Link 11399
Resolution FIXED
Resolved on Jun 29, 2013 23:26
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@efriedma-quic

Extended Description

clang provides a slightly noisy set of diagnostics for the following

class Foo {
Foo(Bar const &p);
class Bar {};
};

The results are:

automata.cpp:79:10: error: expected ')'
Foo(Bar const &p);
^
automata.cpp:79:5: note: to match this '('
Foo(Bar const &p);
^
automata.cpp:79:6: error: field has incomplete type 'Foo'
Foo(Bar const &p);
^
automata.cpp:78:7: note: definition of 'Foo' is not complete until the closing '}'
class Foo {
^

The third diagnostic points out the issue that the type 'Bar' is incomplete, however the diagnostic says it has the incomplete type 'Foo'. The attached note then refers to 'Foo' again to point out when exactly the type becomes complete, however because clang got the wrong type it's pointing at the wrong thing.

Also, the first two diagnostics are just unhelpful noise. A better result might be just the following two diagnostics:

automata.cpp:79:6: error: field has incomplete type 'Bar'
Foo(Bar const &p);
^
automata.cpp:80:8: note: definition of 'Bar' is not complete until the closing '}'
class Bar {};
^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions