]> granicus.if.org Git - clang/commit
If a function decl cannot be merged, mark it as invalid.
authorNico Weber <nicolasweber@gmx.de>
Sat, 17 Jan 2015 02:33:17 +0000 (02:33 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 17 Jan 2015 02:33:17 +0000 (02:33 +0000)
commitc04fe08bbe6d736c709b8336efcdc9a5fea7ba96
tree02b605f31b9b20db4cf7a997194d863118314140
parent9d68194a4817ffa5ddc5c1bc690b9dc2c98ee1fc
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226365 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDecl.cpp
test/Parser/DelayedTemplateParsing.cpp
test/Parser/cxx0x-ambig.cpp
test/SemaCXX/class.cpp
test/SemaCXX/cxx1y-constexpr-not-const.cpp
test/SemaCXX/cxx1y-deduced-return-type.cpp
test/SemaCXX/overload-decl.cpp