[LLVMbugs] [Bug 7507] New: poor diagnostic for declaring struct with use of 'new'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 26 12:35:31 PDT 2010


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

           Summary: poor diagnostic for declaring struct with use of 'new'
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: kremenek at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Clang issues a terrible diagnostic for the following code:

$ cat test.cpp
void test() {
  new struct S { int x; };
}

$ clang -c test.cpp
test.cpp:2:7: error: allocation of incomplete type 'struct S'
  new struct S { int x; };
      ^      ~
test.cpp:2:14: note: forward declaration of 'S'
  new struct S { int x; };
             ^
1 error generated.


GCC-4.2 issues a far more lucid diagnostic:

$ gcc -c test.cpp
test.cpp: In function ‘void test()’:
test.cpp:2: error: types may not be defined in a new-type-id

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