]> granicus.if.org Git - clang/commit
Port r163224 to C++.
authorNico Weber <nicolasweber@gmx.de>
Wed, 18 Feb 2015 05:19:40 +0000 (05:19 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 18 Feb 2015 05:19:40 +0000 (05:19 +0000)
commitb279682bcd79c70baecb312e0db0f0e019eee2bf
treeeac36516626ab491cb25859495e248a02cf9945d
parent6f21bc531655d8fc2a826eed97289ee3934c9e01
Port r163224 to C++.

The motivation is to fix a crash on

  struct S {} s;
  Foo S::~S() { s.~S(); }

What was happening here was that S::~S() was marked as invalid since its
return type is invalid, and as a consequence CheckFunctionDeclaration() wasn't
called and S::~S() didn't get merged into S's implicit destructor.  This way,
the class ended up with two destructors, which confused the overload printer
when it suddenly had to print two possible destructors for `s.~S()`.

In addition to fixing the crash, this change also seems to improve diagnostics
in a few other places, see test changes.

Crash found by SLi's bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229639 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDecl.cpp
test/SemaCXX/PR9461.cpp
test/SemaCXX/crashes.cpp
test/SemaCXX/destructor.cpp