[LLVMbugs] [Bug 13183] New: Detect and recover when we encounter '~Foo::Foo() {}'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 22 15:56:14 PDT 2012


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

             Bug #: 13183
           Summary: Detect and recover when we encounter '~Foo::Foo() {}'
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat ~/test.cc
struct Foo {
 ~Foo();
};

~Foo::Foo() {}

$ clang -fsyntax-only ~/test.cc
/home/matthewbg/test.cc:5:1: error: '~Foo' cannot be the name of a variable or
data member
~Foo::Foo() {}
^
/home/matthewbg/test.cc:5:5: error: expected ';' after top level declarator
~Foo::Foo() {}
   ^
   ;
/home/matthewbg/test.cc:5:11: error: expected unqualified-id
~Foo::Foo() {}
         ^
3 errors generated.

This is actually a pretty common mistake for novice C++ programmers, and it
would be really awesome to catch this and give a specialized diagnostic with
fixit.

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