]> granicus.if.org Git - clang/commitdiff
fix another case that assumed that GetTypeForDeclarator would never return null.
authorChris Lattner <sabre@nondot.org>
Sun, 12 Apr 2009 22:15:02 +0000 (22:15 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 12 Apr 2009 22:15:02 +0000 (22:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68918 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/Parser/declarators.c

index 6c2440ff68e4522d8a6556e0f0fb6176e21b42fb..7d276178916dbea07579f7e81d7b3eae97bf2d64 100644 (file)
@@ -3623,10 +3623,8 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
   if (II) Loc = D.getIdentifierLoc();
  
   QualType T = GetTypeForDeclarator(D, S);
-
-  if (getLangOptions().CPlusPlus) {
+  if (getLangOptions().CPlusPlus)
     CheckExtraCXXDefaultArguments(D);
-  }
 
   DiagnoseFunctionSpecifiers(D);
 
@@ -3774,8 +3772,11 @@ Sema::DeclPtrTy Sema::ActOnIvar(Scope *S,
   // example, unnamed unions inject all members into the struct namespace!
   
   QualType T = GetTypeForDeclarator(D, S);
-  assert(!T.isNull() && "GetTypeForDeclarator() returned null type");
   bool InvalidDecl = false;
+  if (T.isNull()) {
+    InvalidDecl = true;
+    T = Context.IntTy;
+  }
   
   if (BitWidth) {
     // 6.7.2.1p3, 6.7.2.1p4
index d8cd5b6586c05b7bd76ad54b9cf389b6a870338c..a4b2aad09d88c947387a6e41f700aa73102e5933 100644 (file)
@@ -64,4 +64,3 @@ static f;      // expected-warning {{type specifier missing, defaults to 'int'}}
 static g = 4;  // expected-warning {{type specifier missing, defaults to 'int'}}
 static h        // expected-warning {{type specifier missing, defaults to 'int'}} 
       __asm__("foo"); // expected-warning {{extension used}}
-