summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-05 20:54:04 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-05 20:54:04 +0000
commit4ebb7f3e4c5f4d2a25b6a71b6f5091467a5a7bef (patch)
treeea6095f676d17968aab97b9ef70862445c9bdcd2 /clang/lib
parented4e2950bc31eefd1fb4b4c40b99c1e712876734 (diff)
downloadbcm5719-llvm-4ebb7f3e4c5f4d2a25b6a71b6f5091467a5a7bef.tar.gz
bcm5719-llvm-4ebb7f3e4c5f4d2a25b6a71b6f5091467a5a7bef.zip
Be a little more careful when trying to extract a TypeDecl from a enum/class/struct/union specifier; in invalid code, we may also see ClassTemplateDecls.
llvm-svn: 86171
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaType.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index f003127f149..93ef1ea2ead 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -229,7 +229,8 @@ static QualType ConvertDeclSpecToType(Declarator &TheDeclarator, Sema &TheSema){
case DeclSpec::TST_enum:
case DeclSpec::TST_union:
case DeclSpec::TST_struct: {
- TypeDecl *D = cast_or_null<TypeDecl>(static_cast<Decl *>(DS.getTypeRep()));
+ TypeDecl *D
+ = dyn_cast_or_null<TypeDecl>(static_cast<Decl *>(DS.getTypeRep()));
if (!D) {
// This can happen in C++ with ambiguous lookups.
Result = Context.IntTy;
OpenPOWER on IntegriCloud