diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaType.cpp | 6 | ||||
| -rw-r--r-- | clang/test/Sema/types.c | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 45824060654..95c3698bf1e 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1188,6 +1188,9 @@ static std::string getPrintableNameForEntity(DeclarationName Entity) { QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS) { + if (T.isNull()) + return QualType(); + // Enforce C99 6.7.3p2: "Types other than pointer types derived from // object or incomplete types shall not be restrict-qualified." if (Qs.hasRestrict()) { @@ -1226,6 +1229,9 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA, const DeclSpec *DS) { + if (T.isNull()) + return QualType(); + // Convert from DeclSpec::TQ to Qualifiers::TQ by just dropping TQ_atomic. unsigned CVR = CVRA & ~DeclSpec::TQ_atomic; diff --git a/clang/test/Sema/types.c b/clang/test/Sema/types.c index 1ed8dae4c80..5614d164a5f 100644 --- a/clang/test/Sema/types.c +++ b/clang/test/Sema/types.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9 -// RUN: %clang_cc1 %s -pedantic -verify -triple=mips64-linux-gnu -// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-unknown-linux -// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-unknown-linux-gnux32 +// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-apple-darwin9 +// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=mips64-linux-gnu +// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-unknown-linux +// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-unknown-linux-gnux32 // rdar://6097662 typedef int (*T)[2]; @@ -84,3 +84,7 @@ void convert() { uchar32 r = 0; r.s[ 1234 ] = 1; // expected-error {{illegal vector component name 's'}} } + +int &*_Atomic null_type_0; // expected-error {{expected identifier or '('}} +int &*__restrict__ null_type_1; // expected-error {{expected identifier or '('}} +int ^_Atomic null_type_2; // expected-error {{block pointer to non-function type is invalid}} |

