diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-12 22:15:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-12 22:15:02 +0000 |
commit | 6491f47670661c7c9e546cbc3ca7bae2f9850f21 (patch) | |
tree | fb9b4dd98af16a02289bca2a23f371b8b32f8442 | |
parent | 33c6ebef6f9acad6eb667fff77ff78f0c169332c (diff) |
fix another case that assumed that GetTypeForDeclarator would never return null.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68918 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 9 | ||||
-rw-r--r-- | test/Parser/declarators.c | 1 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 6c2440ff68..7d27617891 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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 diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c index d8cd5b6586..a4b2aad09d 100644 --- a/test/Parser/declarators.c +++ b/test/Parser/declarators.c @@ -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}} - |