diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2015-01-17 02:33:17 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2015-01-17 02:33:17 +0000 |
| commit | 71e377d6eead9cf27bee1b1e3cf5d38175401e89 (patch) | |
| tree | 80eae167df9240c405ec9a3444442d167590209f /clang/lib | |
| parent | b6cb6951351f0d6a7f8bc56d26aba0383ed722c7 (diff) | |
| download | bcm5719-llvm-71e377d6eead9cf27bee1b1e3cf5d38175401e89.tar.gz bcm5719-llvm-71e377d6eead9cf27bee1b1e3cf5d38175401e89.zip | |
If a function decl cannot be merged, mark it as invalid.
Clang currently crashes on
class C {
C() = default;
C() = delete;
};
My cunning plan for fixing this was to change the `if (!FnD)` in
Parser::ParseCXXInlineMethodDef() to `if (!FnD || FnD->isInvalidDecl)` – but
alas, the second constructor decl wasn't marked as invalid. This lets
Sema::MergeFunctionDecl() return true on function redeclarations, which leads
to them being marked invalid.
This also improves error messages when functions are redeclared.
llvm-svn: 226365
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 9b9a6afbfd8..9aa1d9ca83c 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2761,6 +2761,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, << New << New->getType(); } Diag(OldLocation, PrevDiag) << Old << Old->getType(); + return true; // Complain if this is an explicit declaration of a special // member that was initially declared implicitly. |

