Commit a0b6a3d5 authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Merging r228785:

------------------------------------------------------------------------
r228785 | rsmith | 2015-02-10 17:48:47 -0800 (Tue, 10 Feb 2015) | 2 lines

PR21857: weaken an incorrect assertion.

------------------------------------------------------------------------

llvm-svn: 228789
parent fa2e9501
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -2500,8 +2500,18 @@ Sema::SpecialMemberOverloadResult *Sema::LookupSpecialMember(CXXRecordDecl *RD,
  // will always be a (possibly implicit) declaration to shadow any others.
  OverloadCandidateSet OCS(RD->getLocation(), OverloadCandidateSet::CSK_Normal);
  DeclContext::lookup_result R = RD->lookup(Name);
  assert(!R.empty() &&

  if (R.empty()) {
    // We might have no default constructor because we have a lambda's closure
    // type, rather than because there's some other declared constructor.
    // Every class has a copy/move constructor, copy/move assignment, and
    // destructor.
    assert(SM == CXXDefaultConstructor &&
           "lookup for a constructor or assignment operator was empty");
    Result->setMethod(nullptr);
    Result->setKind(SpecialMemberOverloadResult::NoMemberOrDeleted);
    return Result;
  }

  // Copy the candidates as our processing of them may load new declarations
  // from an external source and invalidate lookup_result.
+9 −0
Original line number Diff line number Diff line
@@ -437,3 +437,12 @@ namespace error_in_transform_prototype {
    f(S()); // expected-note {{requested here}}
  }
}

namespace PR21857 {
  template<typename Fn> struct fun : Fn {
    fun() = default;
    using Fn::operator();
  };
  template<typename Fn> fun<Fn> wrap(Fn fn);
  auto x = wrap([](){});
}