diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-02-05 06:12:42 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-02-05 06:12:42 +0000 |
| commit | 1aa3edbb99852d587edf8b088fa7c7e9fb4da6d6 (patch) | |
| tree | aeb17a8bd57f86aa5413ccb91353f515a141240d /clang/lib | |
| parent | 94e6d98caecc7e32eb5a31248631507fc6af6230 (diff) | |
| download | bcm5719-llvm-1aa3edbb99852d587edf8b088fa7c7e9fb4da6d6.tar.gz bcm5719-llvm-1aa3edbb99852d587edf8b088fa7c7e9fb4da6d6.zip | |
A function declarator with a non-identifier name in an anonymous class
is a constructor for that class, right? Fixes PR6238.
llvm-svn: 95367
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index bef53df4f0b..28f49d07986 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2737,7 +2737,8 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // (The parser checks for a return type and makes the declarator a // constructor if it has no return type). // must have an invalid constructor that has a return type - if (Name.getAsIdentifierInfo() == cast<CXXRecordDecl>(DC)->getIdentifier()){ + if (Name.getAsIdentifierInfo() && + Name.getAsIdentifierInfo() == cast<CXXRecordDecl>(DC)->getIdentifier()){ Diag(D.getIdentifierLoc(), diag::err_constructor_return_type) << SourceRange(D.getDeclSpec().getTypeSpecTypeLoc()) << SourceRange(D.getIdentifierLoc()); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index e746a8e98c3..7fbbed40890 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -433,7 +433,7 @@ bool Sema::isCurrentClassName(const IdentifierInfo &II, Scope *, } else CurDecl = dyn_cast_or_null<CXXRecordDecl>(CurContext); - if (CurDecl) + if (CurDecl && CurDecl->getIdentifier()) return &II == CurDecl->getIdentifier(); else return false; |

