[LLVMbugs] [Bug 11399] New: diagnostic for referring to nested class before that type is complete refers to wrong type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 18 08:44:53 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11399

             Bug #: 11399
           Summary: diagnostic for referring to nested class before that
                    type is complete refers to wrong type
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: seth.cantrell at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


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 {};
              ^

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list