diff options
author | Anders Carlsson <andersca@mac.com> | 2009-03-24 01:46:45 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-03-24 01:46:45 +0000 |
commit | 8f0d218598a19ef1735819d6d3578a62d2882dd4 (patch) | |
tree | 6f6a325f671aeee70bd2bc27a86bd7a7375dc020 /clang | |
parent | b0ab31b7f6648bd0a33838a4cdc6e53134fc00c3 (diff) | |
download | bcm5719-llvm-8f0d218598a19ef1735819d6d3578a62d2882dd4.tar.gz bcm5719-llvm-8f0d218598a19ef1735819d6d3578a62d2882dd4.zip |
Handle pointers to arrays of abstract types.
llvm-svn: 67598
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 9 | ||||
-rw-r--r-- | clang/test/SemaCXX/abstract.cpp | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index d1b210df462..89805a84ac3 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -792,7 +792,16 @@ bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T, if (const ArrayType *AT = Context.getAsArrayType(T)) return RequireNonAbstractType(Loc, AT->getElementType(), DiagID, SelID); + + if (const PointerType *PT = T->getAsPointerType()) { + // Find the innermost pointer type. + while (const PointerType *T = PT->getPointeeType()->getAsPointerType()) + PT = T; + if (const ArrayType *AT = Context.getAsArrayType(PT->getPointeeType())) + return RequireNonAbstractType(Loc, AT->getElementType(), DiagID, SelID); + } + const RecordType *RT = T->getAsRecordType(); if (!RT) return false; diff --git a/clang/test/SemaCXX/abstract.cpp b/clang/test/SemaCXX/abstract.cpp index 9c8e2dc9774..dfe0a657982 100644 --- a/clang/test/SemaCXX/abstract.cpp +++ b/clang/test/SemaCXX/abstract.cpp @@ -42,7 +42,9 @@ void f() { t3(C()); // expected-error {{allocation of an object of abstract type 'C'}} } -C e[2]; // expected-error {{variable type 'C' is an abstract class}} +C e1[2]; // expected-error {{variable type 'C' is an abstract class}} +C (*e2)[2]; // expected-error {{variable type 'C' is an abstract class}} +C (**e3)[2]; // expected-error {{variable type 'C' is an abstract class}} void t4(C c[2]); // expected-error {{parameter type 'C' is an abstract class}} |