[LLVMbugs] [Bug 5156] New: clang crashes on incorrect code

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Oct 8 15:28:23 PDT 2009


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

           Summary: clang crashes on incorrect code
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: Mac System 9.x
            Status: NEW
          Severity: normal
          Priority: P2
         Component: parser
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: fjahanian at apple.com
                CC: llvmbugs at cs.uiuc.edu


Forgot to put expected-note in the comment and clang horribly got confused and
crashed.

test is CXX/Temp/temp.spec/temp.expl.spec/p4.cpp and I just show the diff of my
mistake.

Index: p4.cpp
===================================================================
--- p4.cpp      (revision 83583)
+++ p4.cpp      (working copy)
@@ -13,7 +13,7 @@
   void g() { }

   struct Inner { 
-    T value;   // expected-note {{member is declared here}}
+    T value;   expected-note {{member is declared here}}
   };

   static T value;

p4.cpp:16:15: error: unknown type name 'expected'
    T value;    expected-note {{member is declared here}}
                ^
p4.cpp:16:23: error: expected member name or ';' after declaration specifiers
    T value;    expected-note {{member is declared here}}
                ~~~~~~~~^
p4.cpp:19:12: error: redefinition of 'value' as different kind of symbol
  static T value;
           ^
p4.cpp:16:7: note: previous definition is here
    T value;    expected-note {{member is declared here}}
      ^
p4.cpp:22:19: error: declaration of 'T' shadows template parameter
template<typename T, typename U>
                  ^
p4.cpp:7:19: note: template parameter is declared here
template<typename T, typename U>
                  ^
p4.cpp:22:31: error: declaration of 'U' shadows template parameter
template<typename T, typename U>
                              ^
p4.cpp:7:31: note: template parameter is declared here
template<typename T, typename U>
                              ^
p4.cpp:38:6: error: implicit instantiation of undefined template 'struct
X<struct IntHolder, long>'
void X<IntHolder, long>::f() { }
     ^
p4.cpp:8:8: note: template is declared here
struct X { // expected-note{{here}}
       ^
p4.cpp:38:26: error: no function template matches function template
specialization 'f'
void X<IntHolder, long>::f() { }
                         ^
p4.cpp:41:8: error: incomplete type 'struct X<struct IntHolder, long>' named in
nested name specifier
struct X<IntHolder, long>::Inner {
       ^~~~~~~~~~~~~~~~~~~~
p4.cpp:8:8: note: forward declaration of 'struct X<struct IntHolder, long>'
struct X { // expected-note{{here}}
       ^
p4.cpp:47:11: error: incomplete type 'struct X<struct IntHolder, long>' named
in nested name specifier
IntHolder X<IntHolder, long>::value = 17;
          ^~~~~~~~~~~~~~~~~~~~
p4.cpp:8:8: note: forward declaration of 'struct X<struct IntHolder, long>'
struct X { // expected-note{{here}}
       ^
p4.cpp:47:31: error: duplicate member 'value'
IntHolder X<IntHolder, long>::value = 17;
                              ^
p4.cpp:23:12: note: previous declaration is here
T X<T, U>::value; // expected-error{{no matching constructor}}
           ^
p4.cpp:47:31: error: 'value' can only be initialized if it is a static const
integral data member
IntHolder X<IntHolder, long>::value = 17;
                              ^
p4.cpp:59:1: error: incomplete type 'struct X<struct IntHolder, long>' named in
nested name specifier
X<IntHolder, long>::X() { } // expected-error{{instantiated member}}
^~~~~~~~~~~~~~~~~~~~
p4.cpp:8:8: note: forward declaration of 'struct X<struct IntHolder, long>'
struct X { // expected-note{{here}}
       ^
0   clang-cc          0x0000000101106907 PrintStackTrace(void*) + 38
1   clang-cc          0x0000000101106e95 SignalHandler(int) + 336
2   libSystem.B.dylib 0x00007fff852642fa _sigtramp + 26
3   libSystem.B.dylib 0x0000000000000001 _sigtramp + 2061090081
4   clang-cc          0x00000001003ba251
clang::LocInfoType::classof(clang::Type const*) + 21
5   clang-cc          0x00000001003ba861 bool
llvm::isa_impl<clang::LocInfoType, clang::Type>(clang::Type const&) + 21
6   clang-cc          0x00000001003ba87b
llvm::isa_impl_wrap<clang::LocInfoType, clang::Type const, clang::Type
const>::doit(clang::Type const&) + 21
7   clang-cc          0x00000001003ba895 bool
llvm::isa_impl_cl<clang::Type>::isa<clang::LocInfoType>(clang::Type const&) +
21
8   clang-cc          0x00000001003ba8af bool
llvm::isa_impl_cl<clang::Type*>::isa<clang::LocInfoType>(clang::Type*) + 21
9   clang-cc          0x00000001003ba8cc bool llvm::isa_impl_cl<clang::Type*
const>::isa<clang::LocInfoType>(clang::Type* const&) + 24


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